gpt4 book ai didi

spring - 相当于非 Boot Spring 项目的 org.springframework.boot.context.embedded.FilterRegistrationBean?

转载 作者:行者123 更新时间:2023-12-04 00:30:18 27 4
gpt4 key购买 nike

我正在尝试按照 this tutorial 在 Spring 中实现外部 session 处理.不过,我在添加正确的过滤器时遇到了一些麻烦。 Spring Boot 似乎定义了正确的 bean/filter,但我的项目不是 Spring Boot,所以它找不到 FilterRegistrationBean .在 Spring 的非 Boot 版本中是否有某种等价于这个类?我也试过 org.springframework.web.context.embedded.FilterRegistrationBean ,但无法正确导入(看起来这个文档指的是 SNAPSHOT 版本,所以也许这个包从来都不是正确版本的一部分)。

最佳答案

根据您的容器配置,web.xml 或 ServletContainerInitializer ,您可以注册 DelegatingFilterProxy 过滤并使其按名称引用 Filter您在 ApplicationContext 中声明的 bean .

关于spring - 相当于非 Boot Spring 项目的 org.springframework.boot.context.embedded.FilterRegistrationBean?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28775431/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com