1. 程式人生 > >Spring Cloud Feign fallback錯誤解決

Spring Cloud Feign fallback錯誤解決

今天在啟動時報了下面這個錯誤

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.fangjia.api.client.auth.AuthRemoteClient': FactoryBean threw exception on
object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.fangjia.api.client.auth.AuthRemoteClient': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'com.fangjia.api.client.auth.AuthRemoteClient': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name java.lang.StackOverflowError ... 1024 common frames omitted

從錯誤資訊看的出是遞迴導致的,而我這邊報錯的點是Feign呼叫的地方

最後排查下來發現是@FeignClient中fallback的值配置錯了,應該配置介面的實現類,而我這邊配置的就是介面本身,所以導致了遞迴呼叫。