Title | spring boot controller 404 spring boot controller 404 | ||||||
Writer | 이지섭 | Write Date | Jul 2 2024 | Modify Date | Jul 29 2024 | View Count | 1467 |
If Spring Boot calls the address you mapped to the controller and gets a 404,
You can handle this in one of two ways
1) You can add a ComponentScan annotation to directly specify which packages to scan.
@SpringBootApplication
@ComponentScan(basePackages = {"com.example", "com.test"})
2) Place the controller under the Spring Boot main application's package.
If the Spring Boot main application's package is com.example.demo,
you would set the controller's package to be subordinate to com.example.demo.
| |||||||