Ensure only supported listeners are instantiated
Previously all EventListeners were eagerly instantiated but that can cause problems because it happens quite early in the lifecycle. Better to be explicit about the supported types.
This commit is contained in:
@@ -47,6 +47,7 @@ import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.format.Formatter;
|
||||
import org.springframework.format.FormatterRegistry;
|
||||
import org.springframework.web.accept.ContentNegotiationManager;
|
||||
import org.springframework.web.context.request.RequestContextListener;
|
||||
import org.springframework.web.filter.HiddenHttpMethodFilter;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
import org.springframework.web.servlet.View;
|
||||
@@ -134,6 +135,12 @@ public class WebMvcAutoConfiguration {
|
||||
return resolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(RequestContextListener.class)
|
||||
public RequestContextListener requestContextListener() {
|
||||
return new RequestContextListener();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(View.class)
|
||||
public BeanNameViewResolver beanNameViewResolver() {
|
||||
|
||||
Reference in New Issue
Block a user