Example usage for javax.servlet ServletContextListener ServletContextListener

List of usage examples for javax.servlet ServletContextListener ServletContextListener

Introduction

In this page you can find the example usage for javax.servlet ServletContextListener ServletContextListener.

Prototype

ServletContextListener

Source Link

Usage

From source file:com.span.EmployeeApplication.java

@Bean
protected ServletContextListener listener() {
    return new ServletContextListener() {

        @Override/*ww  w.  j av a  2  s  .co  m*/
        public void contextInitialized(ServletContextEvent sce) {
            logger.info("ServletContext initialized");
        }

        @Override
        public void contextDestroyed(ServletContextEvent sce) {
            logger.info("ServletContext destroyed");
        }

    };
}

From source file:com.ews.services.user.SpringBootUserApplication.java

@Bean
protected ServletContextListener listener() {
    return new ServletContextListener() {
        @Override/*  w ww.j  a  v  a  2 s .  c  om*/
        public void contextInitialized(ServletContextEvent sce) {

        }

        @Override
        public void contextDestroyed(ServletContextEvent sce) {
        }
    };
}

From source file:org.jbr.commons.container.http.WebAppHttpServer.java

@Override
protected void configureApplication(final Server server) throws Exception {
    final ServletContextHandler handler = new ServletContextHandler();
    handler.addEventListener(new ServletContextListener() {
        public void contextDestroyed(final ServletContextEvent event) {
            // NO-OP
        }//from www .  j  a va 2 s  .  com

        public void contextInitialized(final ServletContextEvent event) {
            try {
                webApplicationInitializer.onStartup(event.getServletContext());
            } catch (final Exception e) {
                log.error(e.getMessage(), e);
                throw new RuntimeException(e);
            }
        }
    });
    server.setHandler(handler);
}

From source file:org.opendatakit.boot.Application.java

@Bean
protected ServletContextListener listener() {
    return new ServletContextListener() {

        @Override//from   w w w .j a  v a2 s  .  c o  m
        public void contextDestroyed(ServletContextEvent arg0) {
            logger.info("ServletContext destroyed");
        }

        @Override
        public void contextInitialized(ServletContextEvent arg0) {
            logger.info("ServletContext initialized");
        }

    };
}

From source file:com.lukaklacar.reviews.SampleTomcatApplication.java

@Bean
protected ServletContextListener listener() {
    return new ServletContextListener() {

        @Autowired//from   w  w w .  j a va  2  s  . c o m
        UserRepository userRepository;

        @Override
        public void contextInitialized(ServletContextEvent sce) {
            User u = new User();
            u.setFirstName("Luka");
            userRepository.save(u);

        }

        @Override
        public void contextDestroyed(ServletContextEvent sce) {
            logger.info("ServletContext destroyed");
        }

    };
}

From source file:$.SampleTomcatApplication.java

@Bean
    protected ServletContextListener listener() {
        return new ServletContextListener() {
            @Override//from www.ja va 2 s  .  c o  m
            public void contextInitialized(ServletContextEvent sce) {
                logger.info("ServletContext initialized");
            }

            @Override
            public void contextDestroyed(ServletContextEvent sce) {
                logger.info("ServletContext destroyed");
            }
        };
    }

From source file:br.com.walmart.SampleTomcatApplication.java

@Bean
protected ServletContextListener listener() {
    return new ServletContextListener() {
        @Override//from w  w w .j  av a2  s . c o  m
        public void contextInitialized(ServletContextEvent sce) {
            logger.info("ServletContext initialized");
        }

        @Override
        public void contextDestroyed(ServletContextEvent sce) {
            logger.info("ServletContext destroyed");
        }
    };
}

From source file:burstcoin.observer.Observer.java

@Bean
protected ServletContextListener listener() {
    return new ServletContextListener() {
        @Override// ww w .j  a v a  2  s. c  o  m
        public void contextInitialized(ServletContextEvent sce) {
            LOG.info("ServletContext initialized");
        }

        @Override
        public void contextDestroyed(ServletContextEvent sce) {
            LOG.info("ServletContext destroyed");
        }
    };
}

From source file:net.ljcomputing.sr.config.StatusReporterWebConfiguration.java

/**
 * Listener.//from   w  w  w. ja  v  a  2  s. co m
 *
 * @return the servlet context listener
 */
@Bean
protected ServletContextListener listener() {
    return new ServletContextListener() {

        /**
         * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
         */
        @Override
        public void contextInitialized(ServletContextEvent sce) {
            logger.info("ServletContext initialized");
        }

        /**
         * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
         */
        @Override
        public void contextDestroyed(ServletContextEvent sce) {
            logger.info("ServletContext destroyed");
        }

    };
}

From source file:com.ednardo.loteca.SampleWebJspApplication.java

@Bean
protected ServletContextListener listener() {
    return new ServletContextListener() {
        @Override//from  ww  w . j av  a  2 s  .  c o m
        public void contextInitialized(ServletContextEvent sce) {
            System.out.println("SERVLET CONTEXT initialized");
        }

        @Override
        public void contextDestroyed(ServletContextEvent sce) {
            System.out.println("SERVLET CONTEXT destroyed");
        }
    };
}