Spring 云网关启动失败:找不到具有名称<blank>的网关过滤器工厂



Spring Cloud Gateway 无法启动,并给出以下异常:

service-gateway      | 2020-01-02 13:44:55.910  INFO 22 --- [           main] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
service-gateway      | 2020-01-02 13:44:55.915  INFO 22 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1577943895914 with initial instances count: 11
service-gateway      | 2020-01-02 13:44:55.916  INFO 22 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application SERVICE-GATEWAY with eureka with status UP
service-gateway      | 2020-01-02 13:44:55.917  INFO 22 --- [           main] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1577943895917, current=UP, previous=STARTING]
service-gateway      | 2020-01-02 13:44:55.923  INFO 22 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_SERVICE-GATEWAY/a5881e80ffd5:service-gateway:1790: registering service...
service-gateway      | 2020-01-02 13:44:55.991  INFO 22 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_SERVICE-GATEWAY/a5881e80ffd5:service-gateway:1790 - registration status: 204
service-gateway      | 2020-01-02 13:44:56.051  WARN 22 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is reactor.core.Exceptions$ErrorCallbackNotImplemented: java.lang.IllegalArgumentException: Unable to find GatewayFilterFactory with name 
service-gateway      | 2020-01-02 13:44:56.083  INFO 22 --- [           main] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
service-gateway      | 2020-01-02 13:44:59.085  INFO 22 --- [           main] com.netflix.discovery.DiscoveryClient    : Unregistering ...
service-gateway      | 2020-01-02 13:44:59.093  INFO 22 --- [           main] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_SERVICE-GATEWAY/a5881e80ffd5:service-gateway:1790 - deregister  status: 200
service-gateway      | 2020-01-02 13:44:59.104  INFO 22 --- [           main] com.netflix.discovery.DiscoveryClient    : Completed shut down of DiscoveryClient

在用于创建过滤器的 Spring 云网关代码中,它说:

GatewayFilterFactory factory = this.gatewayFilterFactories.get(definition.getName());
if (factory == null) {
throw new IllegalArgumentException("Unable to find GatewayFilterFactory with name " + definition.getName());
}

因此,如果它未能创建网关过滤器工厂,异常应给出一条消息:

"找不到名称为<some name>的网关过滤器工厂",但是我的日志中没有这样的事情,只是"找不到名称的网关过滤器工厂"。经过 2 天的研究,我终于发现我的配置文件中有一个错误:

- id:  api_assets
uri: lb://BACKEND
predicates:
- Path=/api/assets/**
filters:
- name: AuditFilter
-

带有空白的筛选器名称列表

最新更新