更新时间:2022-06-12 22:20:10
您可以利用 依赖管理机制.
如果您在 pom 的 <dependencyManagement>
部分为 spring-security-web
和 spring-web
创建条目所需的 3.1.0
版本集,工件的托管版本将覆盖传递依赖树中指定的那些.
If you create entries in the <dependencyManagement>
section of your pom for spring-security-web
and spring-web
with the desired 3.1.0
version set the managed version of the artifact will override those specified in the transitive dependency tree.
我不确定这是否真的为您节省了任何代码,但 IMO 是一个更简洁的解决方案.
I'm not sure if that really saves you any code, but it is a cleaner solution IMO.