Spring Boot Controller not mapping

前端 未结 9 1483
慢半拍i
慢半拍i 2021-02-05 02:55

I have used STS and now I am using IntelliJ Ultimate Edition but I am still getting the same output. My controller is not getting mapped thus showing 404 error. I am completely

9条回答
  •  野的像风
    2021-02-05 03:14

    In my opinion, this visibility problem comes when we leave the component scan to Spring which has a particular way of looking for the classes using standard convention. In this scenario as the Starter class(DemoApplication)is in com.webservice.demo package, putting Controller one level below will help Spring to find the classes using the default component scan mechanism. Putting HelloController under com.webservice.demo.controller should solve the issue.

提交回复
热议问题