工具最后日志标注一下错误,或者包含其中错误内容:
Caused by: java.lang.IllegalStateException: No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalancer?
由于Spring Cloud Feign在Hoxton.M2 RELEASED版本之后不再使用Ribbon而是使用spring-cloud-loadbalancer,所以不引入spring-cloud-loadbalancer会报错.
解决方法:
加入spring-cloud-loadbalancer依赖 并且在nacos中排除ribbon依赖,不然loadbalancer无效
排除ribbon依赖
com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discoverycom.netflix.ribbon ribbon
添加依赖
org.springframework.cloud spring-cloud-loadbalancer
如果还是没有解决,请去官方查阅框架对应的版本,实在不行将spring boot和spring cloud的来版本全部降下
注意:最新版本添加依赖后,可能会出现一下错误,循环调用
Description:
The dependencies of some of the beans in the application context form a cycle:
appCarController defined in file [E:WorksNigleEcologySERVICEservice-tpmtargetclassescnnigletpmapibusinessappcarcontrollerAppCarController.class]
↓
appCarServiceImpl (field cn.nigle.tpm.api.modular.setting.maintain.service.MaintainMileageItemService cn.nigle.tpm.api.business.app.car.service.AppCarServiceImpl.maintainMileageItemService)
↓
maintainMileageItemServiceImpl (field private cn.nigle.tpm.api.modular.setting.category.service.CategoryDataService cn.nigle.tpm.api.modular.setting.maintain.service.impl.MaintainMileageItemServiceImpl.categoryDataService)
↓
categoryDataServiceImpl (field private cn.nigle.tpm.api.modular.setting.maintain.service.MaintainItemService cn.nigle.tpm.api.modular.setting.category.service.impl.CategoryDataServiceImpl.maintainItemService)
↓
maintainItemServiceImpl defined in file [E:WorksNigleEcologySERVICEservice-tpmtargetclassescnnigletpmapimodularsettingmaintainserviceimplMaintainItemServiceImpl.class]
↓
attrService (field cn.nigle.tpm.api.modular.product.service.CategoryService cn.nigle.tpm.api.modular.product.service.impl.AttrServiceImpl.categoryService)
↓
categoryService (field cn.nigle.tpm.api.modular.product.service.CategoryBrandRelationService cn.nigle.tpm.api.modular.product.service.impl.CategoryServiceImpl.categoryBrandRelationService)
┌─────┐
| categoryBrandRelationService (field cn.nigle.tpm.api.modular.product.service.ProductBrandService cn.nigle.tpm.api.modular.product.service.impl.CategoryBrandRelationServiceImpl.brandService)
↑ ↓
| brandService (field cn.nigle.tpm.api.modular.product.service.CategoryBrandRelationService cn.nigle.tpm.api.modular.product.service.impl.ProductBrandServiceImpl.categoryBrandRelationService)
└─────┘
Action:
Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.
可在配置文件中设置:
spring.main.allow-circular-references = true.



