I\'m developing a Spring Boot application which uses some Spring Data Repository interfaces:
package test;
@SpringBootApplication
public class Application im
Use a Spring @ComponentScan annotation alongside the SpringBoot @SpringBootApplication and configure a custom base package (you can either specify a list of package names or a list of classes whose package will be used), so for example
@SpringBootApplication
@ComponentScan(basePackages = {"otherpackage", "..."})
public class Application
or
@SpringBootApplication
@ComponentScan(basePackageClasses = {otherpackage.MyClass.class, ...})
public class Application
or since Spring 1.3.0 (Dec. 2016), you can directly write:
@SpringBootApplication(scanBasePackageClasses = {otherpackage.MyClass.class, ...})
public class Application
Note that component scan will find classes inside and below the given packages.
Good to verify the scopes of classes kept in different packages by using @ComponentScan annotation in Spring boot startup custom class.
Also add @Component in modal classes being used to allow framework accessing the classes.
Example is kept at http://www.javarticles.com/2016/01/spring-componentscan-annotation-example.html