【发布时间】:2018-10-07 04:35:00
【问题描述】:
我想在我的 Spring Boot 2.0 应用程序中使用 Spring Actuator Framework。框架本身按预期工作,因此我能够达到例如我的/actuator/health 端点。那里出现了一个登录对话框。我想摆脱它并尝试以下方法:
@Configuration
@EnableWebFluxSecurity
public class SecurityConfiguration {
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
return http
.authorizeExchange()
.matchers(EndpointRequest.to("prometheus")).permitAll()
.matchers(EndpointRequest.toAnyEndpoint()).authenticated()
.anyExchange().permitAll()
.and()
.formLogin()
.and()
.httpBasic()
.and()
.build();
}
但是,在应用程序启动期间,我收到以下错误:
无法实例化 [org.springframework.security.web.server.SecurityWebFilterChain]:工厂方法 'securityWebFilterChain' 抛出异常;嵌套异常是 java.lang.IllegalArgumentException: authenticationManager cannot be null
当然我尝试过搜索,但我总是只能得到描述不同场景或使用 Spring Boot 1.x 框架的安全配置的页面。有人可以帮我吗?
【问题讨论】:
标签: java spring-boot spring-security spring-webflux spring-boot-actuator