Spring boot Spring云网关总是返回HTTP状态503,如何修复?

Spring boot Spring云网关总是返回HTTP状态503,如何修复?,spring-boot,spring-cloud,spring-cloud-gateway,Spring Boot,Spring Cloud,Spring Cloud Gateway,我正在尝试使用SpringCloudGateway和SpringSecurity。但不幸的是,看起来安全性并不重要,所有的请求都要经过它的目的地,或者至少要尝试。只是尝试一下,因为每次我都会得到HTTP状态503。我在春天5号,并且尽可能地“反应”。我做错了什么?当服务尝试使用功能区负载平衡查找目标时,日志中没有任何有趣的内容,只有通常的行。我还启用了网关服务器上的访问日志,希望有一些额外的信息,但什么也没有 我已经简化了我的代码,下面是一些不起作用的最小配置 POM依赖项和依赖项管理: spr

我正在尝试使用SpringCloudGateway和SpringSecurity。但不幸的是,看起来安全性并不重要,所有的请求都要经过它的目的地,或者至少要尝试。只是尝试一下,因为每次我都会得到HTTP状态503。我在春天5号,并且尽可能地“反应”。我做错了什么?当服务尝试使用功能区负载平衡查找目标时,日志中没有任何有趣的内容,只有通常的行。我还启用了网关服务器上的访问日志,希望有一些额外的信息,但什么也没有

我已经简化了我的代码,下面是一些不起作用的最小配置

POM依赖项和依赖项管理:

spring:
  application:
    name: gateway-server
  cloud:
    config:
      name: gateway-server
      username: configUser
      password: configPassword
      discovery:
        enabled: true
        service-id: config-server
eureka:  
  client:
    serviceUrl:
      defaultZone: http://discUser:discPassword@localhost:9002/eureka/
  instance:
    leaseRenewalIntervalInSeconds: 1
    leaseExpirationDurationInSeconds: 2

org.springframework.cloud
SpringCloudStarter网关
org.springframework.cloud
spring cloud starter netflix eureka客户端
org.springframework.cloud
spring云配置客户端
org.springframework.boot
弹簧启动器webflux
org.springframework.boot
spring启动程序日志记录
org.springframework.boot
弹簧启动安全
org.springframework.cloud
spring云依赖关系
${spring cloud.version}
聚甲醛
进口
bootstrap.yml:

spring:
  application:
    name: gateway-server
  cloud:
    config:
      name: gateway-server
      username: configUser
      password: configPassword
      discovery:
        enabled: true
        service-id: config-server
eureka:  
  client:
    serviceUrl:
      defaultZone: http://discUser:discPassword@localhost:9002/eureka/
  instance:
    leaseRenewalIntervalInSeconds: 1
    leaseExpirationDurationInSeconds: 2
安全配置:

spring:
  application:
    name: gateway-server
  cloud:
    config:
      name: gateway-server
      username: configUser
      password: configPassword
      discovery:
        enabled: true
        service-id: config-server
eureka:  
  client:
    serviceUrl:
      defaultZone: http://discUser:discPassword@localhost:9002/eureka/
  instance:
    leaseRenewalIntervalInSeconds: 1
    leaseExpirationDurationInSeconds: 2
@配置
@启用WebFluxSecurity
公共类SecurityConfig{
私有静态最终记录器Logger=LoggerFactory.getLogger(SecurityConfig.class);
@豆子
公共反应用户详细信息服务用户详细信息服务(){
UserDetails user1=User.withDefaultPasswordEncoder()
.username(“discUser”)
.密码(“discPassword”)
.角色(“系统”、“用户”)
.build();
返回新的MapReactiveUserDetailsService(user1);
}
@豆子
公共安全WebFilterChain springSecurityFilterChain(ServerHttpSecurity http){
LOGGER.info(“临时日志:测试”);
返回http
.csrf()
.disable()
.httpBasic()
.及()
.授权交易所()
.pathMatchers(“/eureka/**”)
.hasRole(“系统”)
.pathMatchers(“/eureka/css/**”和“/eureka/js/**”)
.permitAll()
.及()
.build();
}
}
网关路由定义:

spring:
  application:
    name: gateway-server
  cloud:
    config:
      name: gateway-server
      username: configUser
      password: configPassword
      discovery:
        enabled: true
        service-id: config-server
eureka:  
  client:
    serviceUrl:
      defaultZone: http://discUser:discPassword@localhost:9002/eureka/
  instance:
    leaseRenewalIntervalInSeconds: 1
    leaseExpirationDurationInSeconds: 2
@springboot应用程序
@ComponentScan(basePackages={“com.besztercekk.tao.gateway”})
@EnableDiscoveryClient
公共类网关应用程序{
公共静态void main(字符串[]args){
run(GatewayApplication.class,args);
}
@自动连线
@豆子
RouteLocator自定义路由(RouteLocatorBuilder、LoggingFilter和LoggingFilter){
returnbuilder.routes()
.route(“eureka”,右->右路径(“/eureka”)
.过滤器(f->{
f、 过滤器(记录过滤器);
返回f;
}).uri(“lb://discovery server:9002”))
.build();
}
}
如果我从浏览器调用网关服务(没有任何用户名),我希望得到一个登录表单,或者至少是一个403,因为我没有定义用户,所以安全性无法真正完成它的工作

但我只看到错误回退页面说:

2019年3月31日星期日11:46:42 UTC 出现意外错误(类型=服务不可用,状态=503)。 找不到服务或项目

如果我从命令行调用该网关,例如使用curl,如下所示:

curl——用户discUser:discPasswordhttp://localhost:8080/eureka

然后我得到同样的错误

任何帮助都将不胜感激