Spring Boot Error: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration [How to Solve]

Screenshot of error reporting

problem analysis

I wrote the startup class of spring boot under config , not under the root directory, because I used @ componentscan


Scheme 1: Class

Write a spring boot startup class under the root directory (no need)

Scheme II: Notes

Specify the startup class on my unit test class

@SpringBootTest(classes = Application.class)

Similar Posts: