Search code examples
javaspringspring-bootspring-mvcspring-restcontroller

Spring-Boot Endpoint/Controller Not Found 404


When I create a new spring-boot project and then add a simple controller and try to hit the endpoint, I get 404 (Not found). If I move the same code to the main spring boot application it works (I've added the annotations @RestController.. as you can see) The other strange thing is that if I get the "not working code" from another machine (create the project on another PC and clone/transfer it to my current machine), it works completely fine. What may be the issue? Current machine(Mac Air M1) Spring-Boot -v 3.0.3 Gradle 8.0.1 Installed using brew

I tried other things from different sources. Nothing helped for now.

Main App Controller


Solution

  • Downgrade/upgrade your spring to a different version, 3.0.3 has a bug with component scanning https://github.com/spring-projects/spring-boot/issues/34379