alibaba / spring-cloud-alibaba

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
https://sca.aliyun.com
Apache License 2.0
28.01k stars 8.35k forks source link

openfeign4.0 with sentinel run failed! #3024

Closed zev-223 closed 1 year ago

zev-223 commented 1 year ago

Caused by: java.lang.NullPointerException: Cannot invoke "org.springframework.cloud.openfeign.FeignClientFactoryBean.getFallback()" because "feignClientFactoryBean" is null at com.alibaba.cloud.sentinel.feign.SentinelFeign$Builder$1.create(SentinelFeign.java:93) ~[spring-cloud-starter-alibaba-sentinel-2022.0.0.0-RC1.jar:2022.0.0.0-RC1] at org.springframework.cloud.openfeign.FeignCachingInvocationHandlerFactory.create(FeignCachingInvocationHandlerFactory.java:50) ~[spring-cloud-openfeign-core-4.0.0.jar:4.0.0] at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:59) ~[feign-core-12.1.jar:na] at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:50) ~[feign-core-12.1.jar:na] at feign.Feign$Builder.target(Feign.java:197) ~[feign-core-12.1.jar:na] at org.springframework.cloud.openfeign.DefaultTargeter.target(DefaultTargeter.java:30) ~[spring-cloud-openfeign-core-4.0.0.jar:4.0.0] at org.springframework.cloud.openfeign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:398) ~[spring-cloud-openfeign-core-4.0.0.jar:4.0.0] at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:446) ~[spring-cloud-openfeign-core-4.0.0.jar:4.0.0] at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:421) ~[spring-cloud-openfeign-core-4.0.0.jar:4.0.0] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:148) ~[spring-beans-6.0.3.jar:6.0.3] ... 33 common frames omitted

ruansheng8 commented 1 year ago

Fixed #3007 该问题已在下个版本中修复 , 目前可以通过开启懒加载来解决该问题: 将 spring.cloud.openfeign.lazy-attributes-resolution 设置为 true