之前feign使用都是正常的,即使報錯也能很快定位到問題,最近工作居然報了這個錯誤,首先找到ConfigurationPropertiesRebinderAutoConfiguration類,然后找到內部類BeanPostProcessorChecker ,這個只是一個日志並沒有拋出錯誤,剛開始沒留意,后面跟源碼發現這里只是一個啟發點,於是debug這里,一直跟代碼,后面報錯是服務找不到,為什么這種錯誤沒拋出來,之前的人寫了日志封裝,錯誤日志給吞了,另外給我服務名的人給的小寫,eureka上是大寫的,改好就好了
org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor
private static final class BeanPostProcessorChecker implements BeanPostProcessor { private static final Log logger = LogFactory.getLog(BeanPostProcessorChecker.class); private final ConfigurableListableBeanFactory beanFactory; private final int beanPostProcessorTargetCount; public BeanPostProcessorChecker(ConfigurableListableBeanFactory beanFactory, int beanPostProcessorTargetCount) { this.beanFactory = beanFactory; this.beanPostProcessorTargetCount = beanPostProcessorTargetCount; } @Override public Object postProcessBeforeInitialization(Object bean, String beanName) { return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) { if (!(bean instanceof BeanPostProcessor) && !isInfrastructureBean(beanName) && this.beanFactory.getBeanPostProcessorCount() < this.beanPostProcessorTargetCount) { if (logger.isInfoEnabled()) { logger.info("Bean '" + beanName + "' of type [" + bean.getClass().getName() + "] is not eligible for getting processed by all BeanPostProcessors " + "(for example: not eligible for auto-proxying)"); } } return bean; }
上面只是我遇到問題解決的切入點,后面跟的代碼報錯找不到位置了,大家遇到類似問題跟代碼就好,我這里把FeignClient對應的服務名寫正確問題就解決了