org.springframework.web.context.ContextCleanupListener Java Examples
The following examples show how to use
org.springframework.web.context.ContextCleanupListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebApplicationContextScopeTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testApplicationScope() { WebApplicationContext ac = initApplicationContext(WebApplicationContext.SCOPE_APPLICATION); assertNull(ac.getServletContext().getAttribute(NAME)); DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class); assertSame(bean, ac.getServletContext().getAttribute(NAME)); assertSame(bean, ac.getBean(NAME)); new ContextCleanupListener().contextDestroyed(new ServletContextEvent(ac.getServletContext())); assertTrue(bean.wasDestroyed()); }
Example #2
Source File: WebApplicationContextScopeTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testApplicationScope() { WebApplicationContext ac = initApplicationContext(WebApplicationContext.SCOPE_APPLICATION); assertNull(ac.getServletContext().getAttribute(NAME)); DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class); assertSame(bean, ac.getServletContext().getAttribute(NAME)); assertSame(bean, ac.getBean(NAME)); new ContextCleanupListener().contextDestroyed(new ServletContextEvent(ac.getServletContext())); assertTrue(bean.wasDestroyed()); }
Example #3
Source File: PortletApplicationContextScopeTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testApplicationScope() { ConfigurablePortletApplicationContext ac = initApplicationContext(WebApplicationContext.SCOPE_APPLICATION); assertNull(ac.getPortletContext().getAttribute(NAME)); DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class); assertSame(bean, ac.getPortletContext().getAttribute(NAME)); assertSame(bean, ac.getBean(NAME)); new ContextCleanupListener().contextDestroyed(new ServletContextEvent(ac.getServletContext())); assertTrue(bean.wasDestroyed()); }
Example #4
Source File: WebApplicationContextScopeTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testApplicationScope() { WebApplicationContext ac = initApplicationContext(WebApplicationContext.SCOPE_APPLICATION); assertNull(ac.getServletContext().getAttribute(NAME)); DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class); assertSame(bean, ac.getServletContext().getAttribute(NAME)); assertSame(bean, ac.getBean(NAME)); new ContextCleanupListener().contextDestroyed(new ServletContextEvent(ac.getServletContext())); assertTrue(bean.wasDestroyed()); }