当放置在其他模块中时,为什么Spring Security将401投掷?
我正在尝试根据 hexagonal Architecture 创建 Gradle多模块项目。
当前,执行./ gradlew -q projects
:
< img src =“ https://i.sstatic.net/vpfzu.png” alt =“在此处输入图像说明”>
除了 Spring Security 外,我的想法是将所有弹簧安全配置保持在不同的模块中。
但是,当将 WebSecurityConfiguration保留在不是的模块中 boot Module ()中() /em>),它始终抛出 401 。
这是摘要:
- 当WebsecurityConfiguration类留在启动模块中时,它的工作方式就像魅力✅
- png“ rel =” nofollow noreferrer“>
要牢记的事情:
- application.yaml可以选项1时的安全性。
- 由于该应用程序在选项1时可与Spring Security一起使用WebsecurityConfiguration代码。
- 在答案中,请参阅此线程和 comment 在答案时,我正在面对相同的问题 https://stackoverflow.com/a/58656278
- 所有模块 boot 均配置为
jarenabled = jarenabled = true
,因此它们不可引导。
任何帮助都将受到欢迎,因为我会为此疯狂。
I'm trying to create a Gradle multi-module project following the hexagonal architecture.
Currently, my project looks like this when executing ./gradlew -q projects
:
All is working except for Spring Security, my idea was to keep all Spring Security configurations in a different module.
But when keeping the WebSecurityConfiguration in a module that is not the BOOT module (which is the one that contains the actual main class), it throws 401 always.
This is the summary:
- When WebSecurityConfiguration class stays in the BOOT module it works like a charm ✅
- When WebSecurityConfiguration is moved to a different module all rest calls to the controllers return 401 ❌
Things to keep in mind:
- Application.yaml is ok since the application works with spring security when option 1.
- WebSecurityConfiguration code is ok since the application works with spring security when option 1.
- See this thread and the comment on the answer, I'm facing the same problem https://stackoverflow.com/a/58656278
- All modules except BOOT are configured with
jarEnabled = true
, so they are not bootable.
Any help will be welcomed because I am going crazy with this. ????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论