Spring Webflux安全性所有允许的端点都返回404

时间:2018-08-24 15:26:19

标签: spring spring-boot spring-security spring-webflux

我对spring boot的配置有疑问。
我加载了以下入门项目

compile('org.springframework.boot:spring-boot-starter-actuator') compile('org.springframework.boot:spring-boot-starter-data-mongodb-reactive') compile('org.springframework.boot:spring-boot-starter-security') compile('org.springframework.boot:spring-boot-starter-hateoas') compile('org.springframework.boot:spring-boot-starter-webflux')

我的安全配置如下:

@Configuration
@EnableWebFluxSecurity
public class SecurityConfig {

@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
    return http
            .authorizeExchange()
            .pathMatchers("/")
            .permitAll()
            .and()
            .authorizeExchange()
            .pathMatchers("/actuator/**")
            .permitAll()
            .and()
            .build();

}

但是每当我尝试转到执行器端点时,我都会得到404
每当应用程序启动时,我都会得到执行器的以下映射

2018-08-24 17:15:28.835 INFO 60807 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator' 2018-08-24 17:15:28.846 INFO 60807 --- [ restartedMain] .b.a.e.w.r.WebFluxEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public org.reactivestreams.Publisher<org.springframework.http.ResponseEntity<java.lang.Object>> org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler.handle(org.springframework.web.server.ServerWebExchange) 2018-08-24 17:15:28.847 INFO 60807 --- [ restartedMain] .b.a.e.w.r.WebFluxEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" 2018-08-24 17:15:28.847 INFO 60807 --- [ restartedMain] .b.a.e.w.r.WebFluxEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}"

当我尝试去一个端点时,我得到了:

2018-08-24 17:24:31.400 WARN 60846 --- [ctor-http-nio-2] .a.w.r.e.DefaultErrorWebExceptionHandler : Failed to handle request [GET http://localhost:8080/actuator/health]: Response status 404

我在这里想念什么? 感谢您的帮助!

0 个答案:

没有答案