SpringCloud项目 Error creating bean with name 'eurekaAutoServiceRegistration': Singleton bean...

川长思鸟来 2022-02-18 22:55 380阅读 0赞

20190415092546733.png

  1. import org.springframework.beans.BeansException;
  2. import org.springframework.beans.factory.config.BeanDefinition;
  3. import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
  4. import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
  5. import org.springframework.stereotype.Component;
  6. /**
  7. * 如遇到test测试结束报:
  8. * org.springframework.beans.factory.BeanCreationNotAllowedException:
  9. * Error creating bean with name 'eurekaAutoServiceRegistration': Singleton bean...
  10. * 可以加上该配置
  11. */
  12. @Component
  13. public class FeignBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
  14. @Override
  15. public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
  16. BeanDefinition bd = beanFactory.getBeanDefinition("feignContext");
  17. bd.setDependsOn("eurekaServiceRegistry", "inetUtils");
  18. }
  19. }

发表评论

表情:
评论列表 (有 0 条评论,380人围观)

还没有评论,来说两句吧...

相关阅读