@Test public void testFilterOrdering() { load(); List<RegisteredFilter> registeredFilters = this.context .getBean(MockEmbeddedServletContainerFactory.class).getContainer() .getRegisteredFilters(); List<Filter> filters = new ArrayList<Filter>(registeredFilters.size()); for (RegisteredFilter registeredFilter : registeredFilters) { filters.add(registeredFilter.getFilter()); } Iterator<Filter> iterator = filters.iterator(); assertThat(iterator.next()).isInstanceOf(OrderedCharacterEncodingFilter.class); assertThat(iterator.next()).isInstanceOf(SessionRepositoryFilter.class); assertThat(iterator.next()).isInstanceOf(Filter.class); assertThat(iterator.next()).isInstanceOf(Filter.class); assertThat(iterator.next()).isInstanceOf(OrderedRequestContextFilter.class); assertThat(iterator.next()).isInstanceOf(FilterChainProxy.class); }
@Bean public OrderedRequestContextFilter requestContextFilter() { return new OrderedRequestContextFilter(); }
@Bean @ConditionalOnMissingBean({ RequestContextListener.class, RequestContextFilter.class }) public static RequestContextFilter requestContextFilter() { return new OrderedRequestContextFilter(); }
@Bean @ConditionalOnMissingBean({ RequestContextListener.class, RequestContextFilter.class }) public RequestContextFilter requestContextFilter() { return new OrderedRequestContextFilter(); }