Adding to @Reimeus answer,
Make sure to keep MyController
class and BackendApplication
class within main package i.e, com.iz.backend
.
|-src/main/java
|--com.iz.backend
|--controllers
|--MyController
|--BackendApplication
Or, use basePackages:
@SpringBootApplication(scanBasePackages = {"com.iz.backend"})
5
solved @RequestMapping spring boot doesn’t function as expected