@Test // SPR-16972 public void cloneWithApplicationContext() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(NoFilterConfig.class); context.refresh(); WebHttpHandlerBuilder builder = WebHttpHandlerBuilder.applicationContext(context); assertSame(context, ((HttpWebHandlerAdapter) builder.build()).getApplicationContext()); assertSame(context, ((HttpWebHandlerAdapter) builder.clone().build()).getApplicationContext()); }
@Test // SPR-15074 public void orderedWebFilterBeans() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(OrderedWebFilterBeanConfig.class); context.refresh(); HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(context).build(); assertTrue(httpHandler instanceof HttpWebHandlerAdapter); assertSame(context, ((HttpWebHandlerAdapter) httpHandler).getApplicationContext()); MockServerHttpRequest request = MockServerHttpRequest.get("/").build(); MockServerHttpResponse response = new MockServerHttpResponse(); httpHandler.handle(request, response).block(ofMillis(5000)); assertEquals("FilterB::FilterA", response.getBodyAsString().block(ofMillis(5000))); }