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);
}
}
- 我是执行后发现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
- 发现用cmd 找不到的端口
- 参考链接: 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的主要内容,如果未能解决你的问题,请参考以下文章