BeanCreationNotAllowedException: Error creating bean with name 'eurekaAutoServiceRegistration

Posted linus-tan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BeanCreationNotAllowedException: Error creating bean with name 'eurekaAutoServiceRegistration相关的知识,希望对你有一定的参考价值。

https://www.cnblogs.com/edhg/p/10130112.html

https://blog.csdn.net/yudianxiaoxiao/article/details/93674293

  • 原代码
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableFeignClients
@SpringBootApplication
public class WebappApplication{
   
    public static void main(String[] args) {
        SpringApplication.run(WebappApplication.class, args);
    }
}
  • 修改后代码
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableFeignClients
@SpringBootApplication
public class WebappApplication implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition bd = beanFactory.getBeanDefinition("feignContext");
        bd.setDependsOn("eurekaServiceRegistry", "inetUtils");
    }

    public static void main(String[] args) {
        SpringApplication.run(WebappApplication.class, args);
    }
}

以上是关于BeanCreationNotAllowedException: Error creating bean with name 'eurekaAutoServiceRegistration的主要内容,如果未能解决你的问题,请参考以下文章