【发布时间】:2020-03-14 16:43:05
【问题描述】:
我试图为我的应用程序启用 Spring Boot 管理服务器。默认设置工作得很好,但是当我尝试启用安全性时,我收到以下错误:
应用程序启动失败
说明:
在类路径中定义的 bean 'conversionServicePostProcessor' 资源 [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class], 无法注册。具有该名称的 bean 已经 在类路径资源中定义 [org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.class] 并且覆盖被禁用。
行动:
考虑重命名其中一个 bean 或通过设置启用覆盖 spring.main.allow-bean-definition-overriding=true
进程以退出代码 1 结束
我正在使用spring-boot-admin-starter-server (2.2.0-SNAPSHOT) 的最新 SNAPSHOT 版本。这是我的安全配置:
@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)
}
【问题讨论】:
-
我也有同样的问题。你能找到解决办法吗?
标签: kotlin spring-security spring-boot-admin