List of usage examples for org.springframework.boot.web.servlet ServletListenerRegistrationBean setEnabled
public void setEnabled(boolean enabled)
From source file:net.bull.javamelody.JavaMelodyAutoConfiguration.java
/** * Registers the JavaMelody {@link SessionListener}. * @param servletContext ServletContext//from www . j a v a 2 s. com * @return ServletListenerRegistrationBean */ @Bean public ServletListenerRegistrationBean<EventListener> monitoringSessionListener(ServletContext servletContext) { final ServletListenerRegistrationBean<EventListener> servletListenerRegistrationBean = new ServletListenerRegistrationBean<EventListener>( new SessionListener()); if (servletContext.getFilterRegistration("javamelody") != null) { // if webapp deployed as war in a container with MonitoringFilter and SessionListener already added by web-fragment.xml, // do not add again servletListenerRegistrationBean.setEnabled(false); } return servletListenerRegistrationBean; }