org.springframework.web.context.ServletContextAwareBean Java Examples
The following examples show how to use
org.springframework.web.context.ServletContextAwareBean.
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: DispatcherServletTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void dispatcherServletRefresh() throws ServletException { MockServletContext servletContext = new MockServletContext("org/springframework/web/context"); DispatcherServlet servlet = new DispatcherServlet(); servlet.init(new MockServletConfig(servletContext, "empty")); ServletContextAwareBean contextBean = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean.getServletContext()); assertSame(servlet.getServletConfig(), configBean.getServletConfig()); MultipartResolver multipartResolver = servlet.getMultipartResolver(); assertNotNull(multipartResolver); servlet.refresh(); ServletContextAwareBean contextBean2 = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean2 = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean2.getServletContext()); assertSame(servlet.getServletConfig(), configBean2.getServletConfig()); assertNotSame(contextBean, contextBean2); assertNotSame(configBean, configBean2); MultipartResolver multipartResolver2 = servlet.getMultipartResolver(); assertNotSame(multipartResolver, multipartResolver2); servlet.destroy(); }
Example #2
Source File: DispatcherServletTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void dispatcherServletContextRefresh() throws ServletException { MockServletContext servletContext = new MockServletContext("org/springframework/web/context"); DispatcherServlet servlet = new DispatcherServlet(); servlet.init(new MockServletConfig(servletContext, "empty")); ServletContextAwareBean contextBean = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean.getServletContext()); assertSame(servlet.getServletConfig(), configBean.getServletConfig()); MultipartResolver multipartResolver = servlet.getMultipartResolver(); assertNotNull(multipartResolver); ((ConfigurableApplicationContext) servlet.getWebApplicationContext()).refresh(); ServletContextAwareBean contextBean2 = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean2 = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean2.getServletContext()); assertSame(servlet.getServletConfig(), configBean2.getServletConfig()); assertTrue(contextBean != contextBean2); assertTrue(configBean != configBean2); MultipartResolver multipartResolver2 = servlet.getMultipartResolver(); assertTrue(multipartResolver != multipartResolver2); servlet.destroy(); }
Example #3
Source File: DispatcherServletTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void dispatcherServletRefresh() throws ServletException { MockServletContext servletContext = new MockServletContext("org/springframework/web/context"); DispatcherServlet servlet = new DispatcherServlet(); servlet.init(new MockServletConfig(servletContext, "empty")); ServletContextAwareBean contextBean = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean.getServletContext()); assertSame(servlet.getServletConfig(), configBean.getServletConfig()); MultipartResolver multipartResolver = servlet.getMultipartResolver(); assertNotNull(multipartResolver); servlet.refresh(); ServletContextAwareBean contextBean2 = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean2 = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean2.getServletContext()); assertSame(servlet.getServletConfig(), configBean2.getServletConfig()); assertNotSame(contextBean, contextBean2); assertNotSame(configBean, configBean2); MultipartResolver multipartResolver2 = servlet.getMultipartResolver(); assertNotSame(multipartResolver, multipartResolver2); servlet.destroy(); }
Example #4
Source File: DispatcherServletTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void dispatcherServletContextRefresh() throws ServletException { MockServletContext servletContext = new MockServletContext("org/springframework/web/context"); DispatcherServlet servlet = new DispatcherServlet(); servlet.init(new MockServletConfig(servletContext, "empty")); ServletContextAwareBean contextBean = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean.getServletContext()); assertSame(servlet.getServletConfig(), configBean.getServletConfig()); MultipartResolver multipartResolver = servlet.getMultipartResolver(); assertNotNull(multipartResolver); ((ConfigurableApplicationContext) servlet.getWebApplicationContext()).refresh(); ServletContextAwareBean contextBean2 = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean2 = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean2.getServletContext()); assertSame(servlet.getServletConfig(), configBean2.getServletConfig()); assertTrue(contextBean != contextBean2); assertTrue(configBean != configBean2); MultipartResolver multipartResolver2 = servlet.getMultipartResolver(); assertTrue(multipartResolver != multipartResolver2); servlet.destroy(); }
Example #5
Source File: DispatcherServletTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void dispatcherServletRefresh() throws ServletException { MockServletContext servletContext = new MockServletContext("org/springframework/web/context"); DispatcherServlet servlet = new DispatcherServlet(); servlet.init(new MockServletConfig(servletContext, "empty")); ServletContextAwareBean contextBean = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean.getServletContext()); assertSame(servlet.getServletConfig(), configBean.getServletConfig()); MultipartResolver multipartResolver = servlet.getMultipartResolver(); assertNotNull(multipartResolver); servlet.refresh(); ServletContextAwareBean contextBean2 = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean2 = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean2.getServletContext()); assertSame(servlet.getServletConfig(), configBean2.getServletConfig()); assertNotSame(contextBean, contextBean2); assertNotSame(configBean, configBean2); MultipartResolver multipartResolver2 = servlet.getMultipartResolver(); assertNotSame(multipartResolver, multipartResolver2); servlet.destroy(); }
Example #6
Source File: DispatcherServletTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void dispatcherServletContextRefresh() throws ServletException { MockServletContext servletContext = new MockServletContext("org/springframework/web/context"); DispatcherServlet servlet = new DispatcherServlet(); servlet.init(new MockServletConfig(servletContext, "empty")); ServletContextAwareBean contextBean = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean.getServletContext()); assertSame(servlet.getServletConfig(), configBean.getServletConfig()); MultipartResolver multipartResolver = servlet.getMultipartResolver(); assertNotNull(multipartResolver); ((ConfigurableApplicationContext) servlet.getWebApplicationContext()).refresh(); ServletContextAwareBean contextBean2 = (ServletContextAwareBean) servlet.getWebApplicationContext().getBean("servletContextAwareBean"); ServletConfigAwareBean configBean2 = (ServletConfigAwareBean) servlet.getWebApplicationContext().getBean("servletConfigAwareBean"); assertSame(servletContext, contextBean2.getServletContext()); assertSame(servlet.getServletConfig(), configBean2.getServletConfig()); assertTrue(contextBean != contextBean2); assertTrue(configBean != configBean2); MultipartResolver multipartResolver2 = servlet.getMultipartResolver(); assertTrue(multipartResolver != multipartResolver2); servlet.destroy(); }