문제

Normally I would have added org.springframework.web.filter.DelegatingFilterProxy with a snippet like this to web.xml:

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>
        org.springframework.web.filter.DelegatingFilterProxy
    </filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping> 

But with Servlet 3.0 Container and Jetty, I've removed web.xml. I'm trying to add DelegatingFilterProxy to Jetty's launch with:

context.addFilter(DelegatingFilterProxy.class, "/*", EnumSet.allOf(DispatcherType.class));

but I get error:

No bean named 'org.springframework.web.filter.DelegatingFilterProxy-100555887' is defined

How am I supposed to create and add this filter?

도움이 되었습니까?

해결책

context.addFilter(new FilterHolder(new DelegatingFilterProxy("springSecurityFilterChain")), "/*", EnumSet.allOf(DispatcherType.class));

seems to be the correct syntax.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top