0

I am using Spring v1.4.0.RELEASE. and I am getting an exception "org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'trackiHuntServiceImpl': Unsatisfied dependency expressed through field 'deviceService'". Its project is multi-module.

I have listed main class code:

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

1 Answers1

0

Spring could not create the bean trackiHuntServiceImpl because it couldn't create the bean deviceServiceImpl because it culdn't create the bean emailServiceImpl because it depends on an bean eMailMessageSender of type DynamicEmailService that it is not defined.

Basically, you have to define a bean of type DynamicEmailService. When you solve this, probably other definitions will be missing too. Good luck.

Alvaro Arranz
  • 444
  • 2
  • 5