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
Solution
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:
- [Solved] Springboot test class injection bean is null Error: java.lang.NullPointerException…
- javax.websocket.server.ServerContainer not available
- How to Solve JAVA Test Class Error: java.lang.nullpointerexception
- When spring boottest performs unit testing, the injection object reports an error and cannot be tested
- [Solved] Spring Boot Error: “jdbcUrl is required with driverClassName.”
- Spring boot trample log (@ springbootapplication conflicts with @ componentscan)
- Solution to the problem of consider defining a bean of type ‘xxx’ in your configuration in spring boot auto injection
- [Solved] Spring Boot Startup Error: DataSourceProperties$DataSourceBeanCreationException
- This application has no explicit mapping for /error, so you are seeing this as a fallback.
- Spring cloud uses feignclient to start and report an error