我试图为我的应用程序启用 Spring boot 管理服务器。默认设置工作得很好,但是当我尝试启用安全性时,出现以下错误:
应用程序无法启动
描述:
bean“conversionServicePostProcessor”,在类路径中定义
资源
[org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class],
无法注册。已经有一个同名的豆子了
在类路径资源中定义
[org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.class]
并且覆盖被禁用。
Action:
考虑重命名其中一个 bean 或通过设置启用覆盖
spring.main.allow-bean-definition-overriding=true
进程已完成,退出代码为 1
我正在使用最新的 SNAPSHOT 版本spring-boot-admin-starter-server
(2.2.0-快照)。这是我的安全配置:
@EnableAdminServer
@EnableWebFluxSecurity
@Configuration(proxyBeanMethods = false)
class AdminServerSecurityConfigurations(val adminServerProperties: AdminServerProperties) {
@Bean
fun adminServerSecurityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain = http
// @formatter:off
.authorizeExchange()
.pathMatchers("${adminServerProperties.contextPath}/assets/**").permitAll()
.pathMatchers("${adminServerProperties.contextPath}/login").permitAll()
.anyExchange().authenticated().and()
.formLogin().loginPage("${adminServerProperties.contextPath}/login").and()
.logout().logoutUrl("${adminServerProperties.contextPath}/logout").and()
.httpBasic().and()
// @formatter:on
.csrf().disable()
.build()
@Bean
fun notifyLogger(instanceRepository: InstanceRepository) = LoggingNotifier(instanceRepository)
}
我发现了一个更新文档的拉取请求:https://github.com/spring-projects/spring-boot/issues/14069
对于反应式 WebSocket,
{spring-reference}web-reactive.html#webflux-websocket[Spring WebFlux]提供了丰富的支持,
可以通过以下方式访问spring-boot-starter-webflux
模块。
请参阅spring-boot-sample-websocket-reactive
示例项目以了解 WebSockets 的作用
使用 Spring WebFlux 实现。
事实证明,使用 webflux 和 websocket 会导致冲突。
在此拉取请求中,冲突的解决也被拒绝https://github.com/spring-projects/spring-boot/issues/14810
对于反应式 websocket 请参阅此示例https://www.baeldung.com/spring-5-reactive-websockets
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)