BeanCreationNotAllowedException: Error creating bean with name 'eurekaAutoServiceRegistratio

2021-03-02 18:28

阅读:553

标签:erro   tab   def   spring   with   dep   lis   hub   details   

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);
    }
}

  • 我是执行后发现tomcat 端口被占用, 然后win中查看端口也没发现端口被占用, 索性就换了个端口, 然后run, 然后就Congratulations!!!!!!
    • 发现用cmd 找不到的端口
      • netstat -ano| findstr "8002"
        • 8002 是端口号
    • 而用powershell 却可以
      • Get-Process -Id (Get-NetTCPConnection -LocalPort 8002).OwningProcess
        • 8002 是端口号
    • 然后kill 一波
      • taskkill /F /PID 6640
        • 6640 是pid
  • 参考链接: https://github.com/spring-cloud/spring-cloud-netflix/issues/1952#issuecomment-322669642
  • 参考链接: https://winaero.com/blog/kill-process-windows-10/

BeanCreationNotAllowedException: Error creating bean with name 'eurekaAutoServiceRegistration' 以及 Windows 找到端口对应pid

标签:erro   tab   def   spring   with   dep   lis   hub   details   

原文地址:https://www.cnblogs.com/linus-tan/p/13037618.html


评论


亲,登录后才可以留言!