Because I can run the test method correctly, I don't pay much attention to it, but sometimes I will find the reason when I have a lot of spare time.
I can't tell the specific reason, just drop the connection
https://github.com/spring-cloud/spring-cloud-netflix/issues/1952
One of the great gods named
@Component public class FeignBeanFactoryPostProcessor implements BeanFactoryPostProcessor { @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { if (containsBeanDefinition(beanFactory, "feignContext", "eurekaAutoServiceRegistration")) { BeanDefinition bd = beanFactory.getBeanDefinition("feignContext"); bd.setDependsOn("eurekaAutoServiceRegistration"); } } private boolean containsBeanDefinition(ConfigurableListableBeanFactory beanFactory, String... beans) { return Arrays.stream(beans).allMatch(b -> beanFactory.containsBeanDefinition(b)); } }
Of course, the spring staff inside also said
The workaround works when running the application, but not when running tests disappointed
The translation is the latest version when the test still has this problem, but not when running normally
Brother, although we did not say that there is no such problem during normal running, the problem we raised is that there is this problem during testing! ! !
Suddenly, a programmer who fell into the springcloud staff made a bad joke...