關於本次【Unsatisfied dependency expressed through field 'iClientFeignEmployeeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.oppo】


關於本次springboot項目上線遇到的問題歸納:

1.本地合適但是線上掃不到包,報錯:【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】

  原因:掃不到manager里面的包、導致出現問題

  解決前:

@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;

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public static void main(String[] args) {
        applicationContext = SpringApplication.run(SummerExternalApplication.class, args);
    }
}

解決后:

@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)

這樣就能解決掉該問題、主要的原因就是沒有掃描到包、導致出現的問題。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 報錯Error creating bean with name 'orderController': Unsatisfied dependency expressed through field 'orderService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Redis——解決“org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisReferenceResolver': Unsatisfied dependency expressed through constructor parameter 0” org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xtCsDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanC org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.facto Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXX': mvn ssm 異常 org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'multipartResolver' org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bireportSqlSessionFactory' defined in URL 嚴重: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext之解決辦法
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM