cometta
cometta

Reputation: 35689

how to add filterclass into applicationContext?

I have a filterclass that i normally will put in web.xml. may i know how to specify it inside spring applicationcontext so that i able to use spring features in my fitlerclass?

Upvotes: 1

Views: 237

Answers (2)

Gandalf
Gandalf

Reputation: 9855

leonm's answer is 100% correct, but like many things in Spring there are multiple ways of doing this (well at least in Spring Security's case).

You can also subclass SpringSecurityFilter and then add it to the Spring Security Filter Chain like this:

<bean id="mySecurityFilter" class="org.example.MySecurityFilter">
   ...setup like a normal bean
   <custom-filter position="LAST"/>
</bean>

Check out this link <security:custom-filter> for all the different values you can use for the position argument.

Upvotes: 2

leonm
leonm

Reputation: 6484

Use a DelegatingFilterProxy.

Upvotes: 3

Related Questions