Example usage for org.springframework.boot.web.servlet ServletListenerRegistrationBean ServletListenerRegistrationBean

List of usage examples for org.springframework.boot.web.servlet ServletListenerRegistrationBean ServletListenerRegistrationBean

Introduction

In this page you can find the example usage for org.springframework.boot.web.servlet ServletListenerRegistrationBean ServletListenerRegistrationBean.

Prototype

public ServletListenerRegistrationBean(T listener) 

Source Link

Document

Create a new ServletListenerRegistrationBean instance.

Usage

From source file:net.bull.javamelody.JavaMelodyAutoConfiguration.java

/**
 * Registers the JavaMelody {@link SessionListener}.
 * @param servletContext ServletContext/*from w  w  w. ja  v a  2s.  c o m*/
 * @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;
}

From source file:de.dlopes.stocks.facilitator.config.JsfMvcConfig.java

/**
* Register JSF's configure listener// w w  w. j  a  v a  2s.c  o  m
* 
* Hint: this is needed for proper initialization of JSF
* 
* @return a ServletListenerRegistrationBean instance containing the JSF related
*          ConfigureListener
*/
@Bean
public ServletListenerRegistrationBean<ConfigureListener> jsfConfigureListener() {
    return new ServletListenerRegistrationBean<ConfigureListener>(new ConfigureListener());
}

From source file:org.schedoscope.metascope.config.ProductionSpringConfiguration.java

@Bean
public ServletListenerRegistrationBean<HttpSessionEventPublisher> httpSessionEventPublisher() {
    return new ServletListenerRegistrationBean<HttpSessionEventPublisher>(new HttpSessionEventPublisher());
}

From source file:com.evolveum.midpoint.web.boot.MidPointSpringApplication.java

@Bean
public ServletListenerRegistrationBean requestContextListener() {
    return new ServletListenerRegistrationBean(new RequestContextListener());
}