gpt4 book ai didi

java - 不满意的依赖异常 : Error creating bean with name 'trackiHuntServiceImpl' : Unsatisfied dependency expressed through field 'deviceService'

转载 作者:行者123 更新时间:2023-12-01 23:18:24 27 4
gpt4 key购买 nike

我正在使用 Spring v1.4.0.RELEASE。我收到一个异常“org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为“trackiHuntServiceImpl”的bean时出错:通过字段“deviceService”表达的依赖关系不满足”。它的项目是多模块的。

我列出了主类代码:

    @Import({PrimaryRepositoryConfig.class, 
AuditRepositoryConfig.class,
PaypalConfig.class,
BraintreeConfig.class,
CommonConfig.class,
ElasticsearchConfig.class
})
@ComponentScan(basePackages ={"com.trackimo.server.model" ,
"com.trackimo.server.dao",
"com.trackimo.server.services",
"com.trackimo.server.services.account",
"com.trackimo.server.services.email",
"com.trackimo.server.services.common",
"com.trackimo.server.services.location",
"com.trackimo.server.services.user",
"com.trackimo.server.services.trackihunt",
"com.trackimo.server.services.device",
"com.trackimo.server.audit.model",
"com.trackimo.server.audit.dao",
"com.trackimo.server.utils.converters",
"com.trackimo.server.worker",
"com.trackimo.quartz.config"},
excludeFilters = @ComponentScan.Filter(IgnoreDuringScan.class)
)
@SpringBootApplication(exclude = { DispatcherServletAutoConfiguration.class })
@EnableScheduling
@EnableAsync
public class QuartzApplication {

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

}



2019-10-11 16:57:37,072 [main] ERROR o.s.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'trackiHuntServiceImpl': Unsatisfied dependency expressed through field 'deviceService': Error creating bean with name 'deviceServiceImpl': Unsatisfied dependency expressed through field 'emailService': Error creating bean with name 'emailServiceImpl': Unsatisfied dependency expressed through field 'eMailMessageSender': No qualifying bean of type [com.trackimo.server.services.email.DynamicEmailService] found for dependency [com.trackimo.server.services.email.DynamicEmailService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.trackimo.server.services.email.DynamicEmailService] found for dependency [com.trackimo.server.services.email.DynamicEmailService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'emailServiceImpl': Unsatisfied dependency expressed through field 'eMailMessageSender': No qualifying bean of type [com.trackimo.server.services.email.DynamicEmailService] found for dependency [com.trackimo.server.services.email.DynamicEmailService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.trackimo.server.services.email.DynamicEmailService] found for dependency [com.trackimo.server.services.email.DynamicEmailService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deviceServiceImpl': Unsatisfied dependency expressed through field 'emailService': Error creating bean with name 'emailServiceImpl': Unsatisfied dependency expressed through field 'eMailMessageSender': No qualifying bean of type [com.trackimo.server.services.email.DynamicEmailService] found for dependency [com.trackimo.server.services.email.DynamicEmailService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.trackimo.server.services.email.DynamicEmailService] found for dependency [com.trackimo.server.services.email.DynamicEmailService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'emailServiceImpl': Unsatisfied dependency expressed through field 'eMailMessageSender': No qualifying bean of type [com.trackimo.server.services.email.DynamicEmailService] found for dependency [com.trackimo.server.services.email.DynamicEmailService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.trackimo.server.services.email.DynamicEmailService] found for dependency [com.trackimo.server.services.email.DynamicEmailService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

最佳答案

Spring 无法创建 bean trackiHuntServiceImpl,因为它无法创建 bean deviceServiceImpl,因为它无法创建 bean emailServiceImpl,因为它依赖于未定义的 DynamicEmailService 类型的 bean eMailMessageSender。

基本上,您必须定义一个 DynamicEmailService 类型的 bean。当你解决这个问题时,可能其他定义也会丢失。祝你好运。

关于java - 不满意的依赖异常 : Error creating bean with name 'trackiHuntServiceImpl' : Unsatisfied dependency expressed through field 'deviceService' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58340493/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com