Questions about this project on line springboot encountered summarized:
1. Local scan line but not suitable packet, error: [Unsatisfied dependency expressed through field 'iClientFeignEmployeeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.oppo.csc.hrms .client.service.employee.IClientFeignEmployeeService]
Reason: The manager can not sweep the inside of the bag, leading to problems
Solve ago:
@SpringBootApplication(scanBasePackages = {"com.oppo.csc.sso", "com.xiniaoyun.external"}, exclude = {NacosConfigEndpointAutoConfiguration.class}) //就是此处扫描包的 @EnableSpringDataWebSupport @EnableScheduling @EnableFeignClients({"com.xiniaoyun.external.client","com.xiniaoyun.shared", "com.oppo.csc.sso.api", "com.oppo.csc.hrms","com.xiniaoyun.helios"}) @MapperScan(value = "com.xiniaoyun.external.dao", annotationClass = Mapper.class) @EnableDiscoveryClient public class SummerExternalApplication { private static ApplicationContext applicationContext; staticpublic ApplicationContext getApplicationContext() { return applicationContext; } public static void main(String[] args) { applicationContext = SpringApplication.run(SummerExternalApplication.class, args); } }
Resolved:
@SpringBootApplication(scanBasePackages = {"com.oppo.csc.sso", "com.xiniaoyun.external.manager","com.xiniaoyun.external"}, exclude = {NacosConfigEndpointAutoConfiguration.class}) //单独将manager的包扫描一次、后面再扫全局。 @EnableSpringDataWebSupport @EnableScheduling @EnableFeignClients({"com.xiniaoyun.external.client","com.xiniaoyun.shared", "com.oppo.csc.sso.api", "com.oppo.csc.hrms","com.xiniaoyun.helios"}) @MapperScan(value = "com.xiniaoyun.external.dao", annotationClass = Mapper.class)
This will get rid of the problem, not the main reason is to scan the package, causing the problem.