spring-boot w/ embedded tomcat doesn't dispatch requests to controller

后端 未结 1 1310
醉酒成梦
醉酒成梦 2021-02-08 06:36

I have an application using spring-boot and an embedded Tomcat container.

As far as I can tell, my code is the same as the spring-boot sample project. However, when I ru

相关标签:
1条回答
  • 2021-02-08 07:02

    It turns out the issue was the component scanning configuration. Even though the @ComponentScan annotation was used, the controller was under a separate package, so Spring never included it in the dispatcher.

    Adding @ComponentScan(basePackages = "com.my.controller")) solved my issue.

    0 讨论(0)
提交回复
热议问题