/** * Register a {@link ServletContextListener} that closes the given * application context when the servlet context is destroyed. * @param servletContext the servlet context to listen to * @param applicationContext the application context that is to be * closed when {@code servletContext} is destroyed */ protected void registerCloseListener(ServletContext servletContext, ApplicationContext applicationContext) { if (applicationContext instanceof ConfigurableApplicationContext) { ConfigurableApplicationContext cac = (ConfigurableApplicationContext) applicationContext; ServletContextDestroyedListener listener = new ServletContextDestroyedListener(cac); servletContext.addListener(listener); } }
/** * Register a {@link ServletContextListener} that closes the given * application context when the servlet context is destroyed. * @param servletContext the servlet context to listen to * @param applicationContext the application context that is to be * closed when {@code servletContext} is destroyed */ protected void registerCloseListener(ServletContext servletContext, ApplicationContext applicationContext) { if (applicationContext instanceof ConfigurableApplicationContext) { ConfigurableApplicationContext cac = (ConfigurableApplicationContext) applicationContext; ServletContextDestroyedListener listener = new ServletContextDestroyedListener(cac); servletContext.addListener(listener); } }
/** * Register a {@link ServletContextListener} that closes the given * application context when the servlet context is destroyed. * @param servletContext the servlet context to listen to * @param applicationContext the application context that is to be * closed when {@code servletContext} is destroyed */ protected void registerCloseListener(ServletContext servletContext, ApplicationContext applicationContext) { if (applicationContext instanceof ConfigurableApplicationContext) { ConfigurableApplicationContext cac = (ConfigurableApplicationContext) applicationContext; ServletContextDestroyedListener listener = new ServletContextDestroyedListener(cac); servletContext.addListener(listener); } }
/** * Register a {@link ServletContextListener} that closes the given * application context when the servlet context is destroyed. * @param servletContext the servlet context to listen to * @param applicationContext the application context that is to be * closed when {@code servletContext} is destroyed */ protected void registerCloseListener(ServletContext servletContext, ApplicationContext applicationContext) { if (applicationContext instanceof ConfigurableApplicationContext) { ConfigurableApplicationContext cac = (ConfigurableApplicationContext) applicationContext; ServletContextDestroyedListener listener = new ServletContextDestroyedListener(cac); servletContext.addListener(listener); } }