java.lang.IllegalStateException: org.springframework.context.annotation.AnnotationConfigApplicationContext@280d42a1 has not been refreshed yet
I think that the problem is in the method AbstractReactiveWebInitializer#onStartup() because not refresh context. In this previous version RELASE of Spring Framework, I use the now deprecated class AbstractAnnotationConfigDispatcherHandlerInitializer. This class HandlerInitializer refresh context in the method AbstractDispatcherHandlerInitializer#onStartup():
publicclassWebAppInitializerextendsAbstractReactiveWebInitializer {
@OverridepublicvoidonStartup(ServletContextservletContext) throwsServletException {
StringservletName = getServletName();
Assert.hasLength(servletName, "getServletName() must not return empty or null");
ApplicationContextapplicationContext = createApplicationContext();
Assert.notNull(applicationContext,
"createApplicationContext() did not return an application " +
"context for servlet [" + servletName + "]");
refreshApplicationContext(applicationContext);
[....]
I need help you. Thanks a lot!
Affects: 5.0.2
Issue Links:
#20633 Using AbstractAnnotationConfigDispatcherHandlerInitializer to run Spring Webflux application as a WAR doesn't work ("is duplicated by")
The text was updated successfully, but these errors were encountered:
Also, in method AbstractReactiveWebInitializer#createApplicationContext(), you don't use context.register() in order to add the config classes when you create the AnnotationConfigApplicationContext. The code is below:
protectedApplicationContextcreateApplicationContext() {
AnnotationConfigApplicationContextcontext = newAnnotationConfigApplicationContext();
Class<?>[] configClasses = getConfigClasses();
Assert.notEmpty(configClasses, "No Spring configuration provided.");
returncontext;
}
But, I think that the correct code is:
protectedApplicationContextcreateApplicationContext() {
AnnotationConfigApplicationContextcontext = newAnnotationConfigApplicationContext();
Class<?>[] configClasses = getConfigClasses();
Assert.notEmpty(configClasses, "No Spring configuration provided.");
if (!ObjectUtils.isEmpty(configClasses)) {
context.register(configClasses);
}
returncontext;
}
José María Sola Durán opened SPR-16290 and commented
I have this class to start WebFlux context in my web application:
When start the context, I obtain this exception:
I think that the problem is in the method AbstractReactiveWebInitializer#onStartup() because not refresh context. In this previous version RELASE of Spring Framework, I use the now deprecated class AbstractAnnotationConfigDispatcherHandlerInitializer. This class HandlerInitializer refresh context in the method AbstractDispatcherHandlerInitializer#onStartup():
I need help you. Thanks a lot!
Affects: 5.0.2
Issue Links:
The text was updated successfully, but these errors were encountered: