In a Spring boot 1.5.9 application, I have @SpringBootApplication
on my main class.
I also have @KopaxgroupApi
annotation, with :
@Retention(RUNTIME)
@Target(TYPE)
@Import(KopaxgroupApiConfig.class)
public @interface KopaxgroupApi {
@AliasFor(annotation = Import.class, attribute = "value")
Class<?>[] value() default { KopaxgroupApiConfig.class };
}
With KopaxgroupApiConfig.class
being:
@Configuration
@ComponentScan(basePackages = { KopaxgroupApiConfig.CLASSPATH })
public class KopaxgroupApiConfig {
public static final String CLASSPATH = "com.kopaxgroup.api";
}
I have created a new project within com.kopaxgroup.api.customerManagement.callMeBack
and there I have repository and service stored in respectively in directories repository
and service
.
The CallMeBackServiceImpl
cannot find the CallMeBackRepository
.
I am having the following error on startup:
Application failed to start due to an exception
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.kopaxgroup.api.customerManagement.callMeBack.repository.CallMeBackRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1493)
Parameter 0 of constructor in com.kopaxgroup.api.customerManagement.callMeBack.service.impl.CallMeBackServiceImpl required a bean of type 'com.kopaxgroup.api.customerManagement.callMeBack.repository.CallMeBackRepository' that could not be found.
Action:
Consider defining a bean of type 'com.kopaxgroup.api.customerManagement.callMeBack.repository.CallMeBackRepository' in your configuration.
I have tried to move CallMeBackRepository
into com.kopaxgroup.api.customerManagement.callMeBack.service.impl
but the error staid.
I have some similar package and they all can boot, I don't see any difference on the configuration.
This happen when creating a new jar.
I have added a bunch of @ComponentScan
but I couldn't solve it, how can I dig further and see the list of classpath used during @ComponentScan("com.kopaxgroup.api")
?