Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of org.springframework.boot.context.embedded.FilterRegistrationBean for non-Boot Spring project?

I'm trying to implement external session handling in Spring, as per this tutorial. I'm having some trouble adding the right filter though. Spring Boot appears to have defined the proper bean/filter, but my project is not Spring Boot, so it cannot find the FilterRegistrationBean. Is there some sort of equivalent to this class in non-Boot versions of Spring? I also tried org.springframework.web.context.embedded.FilterRegistrationBean, but can't get it to import properly (it looks like this documentation refers to a SNAPSHOT version, so perhaps this package was never part of a proper release).

like image 946
Joseph Blair Avatar asked Oct 20 '22 16:10

Joseph Blair


1 Answers

Depending on your container configuration, web.xml or ServletContainerInitializer, you can register a DelegatingFilterProxy filter and make it refer, by name, to a Filter bean you've declared in your ApplicationContext.

like image 112
Sotirios Delimanolis Avatar answered Oct 22 '22 22:10

Sotirios Delimanolis