@Test public void sessionScopeAvailable() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext( ExampleEmbeddedWebApplicationConfiguration.class, SessionScopedComponent.class); verifyContext(); }
@Test public void sessionScopeAvailableToServlet() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext( ExampleEmbeddedWebApplicationConfiguration.class, ExampleServletWithAutowired.class, SessionScopedComponent.class); Servlet servlet = this.context.getBean(ExampleServletWithAutowired.class); assertThat(servlet).isNotNull(); }
@Test public void registerAndRefresh() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext(); this.context.register(ExampleEmbeddedWebApplicationConfiguration.class); this.context.refresh(); verifyContext(); }
@Test public void scanAndRefresh() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext(); this.context.scan( ExampleEmbeddedWebApplicationConfiguration.class.getPackage().getName()); this.context.refresh(); verifyContext(); }
@Test public void sessionScopeAvailableToServlet() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext( ExampleEmbeddedWebApplicationConfiguration.class, ExampleServletWithAutowired.class, SessionScopedComponent.class); Servlet servlet = this.context.getBean(ExampleServletWithAutowired.class); assertNotNull(servlet); }
@Test public void createFromScan() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext( ExampleEmbeddedWebApplicationConfiguration.class.getPackage().getName()); verifyContext(); }
@Test public void createFromConfigClass() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext( ExampleEmbeddedWebApplicationConfiguration.class); verifyContext(); }