I have annotated my spring boot application class with @SpringBootApplication annotation, but noticed that sometimes it failed to scan my controllers/components. I tried adding @ComponentScan annotation too. But still the component scan is not happening.

Comment From: Nidhi-Tanwar14

There're no mappings info in the logs. But the logs hasn't change even a little. Potential causes which I excluded temporarily:

  • springboot application does not scan the package which controller locates?

I moved springboot application class to the uplevel package, and also specified what kind of package it should scan. While you see, it doesn't work.

  • the annotation issue?

Some people say we should use @RestController annotation instead of @Controller, better add the @ResponseBody, while I did. it does't work, either.

  • the deployment issue?

don't know, I did changed the build path of this project, which generated jar file and war file normally, but webapp folder is empty, since I don't have any static resource, I think it's fine,