issue the following error when unit testing
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context
There are two reasons for this problem
1. See if there is a primary startup class
2. As shown in the figure above, if the main boot class already exists, the error may be in the test directory and will be reported if they are not in the same directory.
Put it in the same directory and the problem is solved.
Read More:
- java.lang.IllegalStateException : unable to read meta data for class
- Android error java.lang.IllegalStateException : System services not available to Activities before onC
- Spring boot running appears java.lang.IllegalStateException : Failed to load ApplicationContext
- java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
- Idea start error: java.lang.IllegalStateException : failed to create a child event loop
- java.lang.IllegalStateException: Could not execute method for android:onClick
- java.lang.IllegalStateException Exception: cause analysis and solution
- Caused by: java.lang.IllegalStateException: Ambiguou There is already ‘XXXXXXController‘ bean method
- java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
- Solution in idea java.lang.ClassNotFoundException : org.springframework.web . context.ContextLoaderListener
- java.lang.IllegalStateException: Logback configuration error detected
- Java error: unable to find or load the main class
- Error in idea compilation: java.lang.OutOfMemoryError Java heap space and java.lang.StackOverflowError
- java.lang.NoSuchMethodError: org.json.JSONObject.put(Java/lang/String; Java/util/Collection;) “209151;”
- [unity] Android package error java.lang.ClassNotFoundException Did not find class com.unity3d . player.MainActivity
- javax.persistence.EntityNotFoundException : unable to find error
- Unable to read scheme document‘ http://www.springframework.org/schema/spring-context.xsd The solution to the problem
- [Solved] VUE Error: “You may use special comments to disable some warnings.Use // eslint-disable-next-line to …
- java.lang.IllegalArgumentException: error at ::0 can‘t find referenced pointcut anyMethod
- The @ Autowired annotation in springboot is invalid in ordinary classes. How to solve and use the null pointer exception java.lang.nullpointerexception