我使用的是 tomcat\spring security,在测试环境中我需要向我的 HEADER 添加一个参数以进行 selenium 测试
在我的开发环境中模拟这个有哪些选择?
- Servlet 过滤器
- 代理
- Spring 或 tomcat 中的其他功能?
过滤器的问题是我必须确保它只在我的开发环境中,代理是额外的配置
最佳答案
如果您使用的是 Spring 配置文件,您可以使用 @Profile("dev")
注释该过滤器,它只会在 dev
配置文件处于 Activity 状态时加载。更多信息:
http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html#boot-features-profiles
关于java - 添加到请求 header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38974512/