主题
常见问题
Object of class [org.springframework.context.support.GenericApplicationContext] must be an instance of interface org.springframework.context.annotation.AnnotationConfigRegistry
CAUTION
出现此异常,是因为网关做lb负载均衡是,需要把服务id打包的程序中,需要联系我们重新打包。
yaml
spring:
cloud:
gateway:
routes:
- id: demo
uri: lb://web-example
java.lang.IllegalArgumentException: Object of class [org.springframework.context.support.GenericApplicationContext] must be an instance of interface org.springframework.context.annotation.AnnotationConfigRegistry
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:592) ~[na:na]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ HTTP POST "/demo/login" [ExceptionHandlingWebHandler]
Original Stack Trace:
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:592) ~[na:na]
at org.springframework.util.Assert.isInstanceOf(Assert.java:492) ~[na:na]
at org.springframework.util.Assert.isInstanceOf(Assert.java:523) ~[na:na]
at org.springframework.cloud.context.named.NamedContextFactory.registerBeans(NamedContextFactory.java:143) ~[gateway.exe:4.1.2]
at org.springframework.cloud.context.named.NamedContextFactory.createContext(NamedContextFactory.java:137) ~[gateway.exe:4.1.2]
at org.springframework.cloud.context.named.NamedContextFactory.getContext(NamedContextFactory.java:122) ~[gateway.exe:4.1.2]
at org.springframework.cloud.context.named.NamedContextFactory.getInstances(NamedContextFactory.java:234) ~[gateway.exe:4.1.2]
at org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter.filter(ReactiveLoadBalancerClientFilter.java:114) ~[gateway.exe:4.1.2]
at org.springframework.cloud.gateway.handler.FilteringWebHandler$GatewayFilterAdapter.filter(FilteringWebHandler.java:147) ~[na:na]
at org.springframework.cloud.gateway.filter.OrderedGatewayFilter.filter(OrderedGatewayFilter.java:44) ~[gateway.exe:4.1.2]
at org.springframework.cloud.gateway.handler.FilteringWebHandler$DefaultGatewayFilterChain.lambda$filter$0(FilteringWebHandler.java:127) ~[na:na]
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:45) ~[na:na]
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53) ~[na:na]
at reactor.core.publisher.Mono.subscribe(Mono.java:4568) ~[gateway.exe:3.6.4]
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:265) ~[gateway.exe:3.6.4]
at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51) ~[na:na]
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53) ~[na:na]
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53) ~[na:na]
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:76) ~[gateway.e
授权失败
请参考授权使用说明