title: DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler
body: <p>I am trying to design a rest api, and below is my controller code. </p>
  
  <p>when i invoke <a href="http://localhost:8080/" rel="noreferrer">http://localhost:8080/</a> the response is fine, but if i hit <a href="http://localhost:8080/api/ca" rel="noreferrer">http://localhost:8080/api/ca</a> it thorws <code>javax.servlet.ServletException: No adapter for handler [...CaDetailController@48224381]: The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler</code></p>
  
  <pre><code>@RestController("/api")
  public class CaDetailController {
  
      private static final Logger logger = LoggerFactory.getLogger(GetClassLoader.class.getClass());
  
      @Autowired
      CaService caService;
  
      @RequestMapping(path = "/ca", method = RequestMethod.GET)
      public @ResponseBody List&lt;CaDetail&gt; getCorporateActions() {
          logger.info("CaDetailController.findAllCaDetails()");
          return caService.findAllCaDetails();
      }
  
      @RequestMapping(path = "/ca/{caId}", method = RequestMethod.GET)
      public @ResponseBody List&lt;CaDetail&gt; getCorporateActions(@PathParam("caId") long caId) {
          logger.info("CaDetailController.getCorporateActions() : caId : " + caId);
          return caService.findAllCaDetails();
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Updated controller.</p>
  </blockquote>
  
  <pre><code>@RestController
  @RequestMapping("/api/ca")
  public class CaDetailController {
  
      private static final Logger logger = LoggerFactory.getLogger(GetClassLoader.class.getClass());
  
      @Autowired
      CaService caService;
  
      @GetMapping(path = "/")
      public @ResponseBody List&lt;CaDetail&gt; getCorporateActions() {
          logger.info("CaDetailController.findAllCaDetails()");
          return caService.findAllCaDetails();
      }
  
      @GetMapping(path = "/{caId}")
      public @ResponseBody List&lt;CaDetail&gt; getCorporateActions(@PathParam("caId") Long caId) {
          logger.info("CaDetailController.getCorporateActions() : caId : " + caId);
          return caService.findAllCaDetails();
      }
  }
  </code></pre>