用于非Boot Spring项目的org.springframework.boot.context.embedded.FilterRegistrationBean的等价物?

我正在尝试在
Spring中实现外部会话处理,如
this tutorial.我在添加正确的过滤器时遇到了一些麻烦. Spring Boot似乎已经定义了正确的bean / filter,但我的项目不是Spring Boot,所以它找不到FilterRegistrationBean.在非Boot的Spring版本中是否存在某种等效的类?我也尝试过
org.springframework.web.context.embedded.FilterRegistrationBean,但无法正确导入它(看起来这个文档指的是SNAPSHOT版本,所以也许这个软件包从来都不是正确版本的一部分). 最佳答案 根据您的容器配置,web.xml或ServletContainerInitializer,您可以注册一个
DelegatingFilterProxy过滤器,并使其按名称引用您在ApplicationContext中声明的过滤器bean.

点赞