After turning on the debug logging level for spring and going through extensive logs, I found that scanning for various components, such as JPA repositories, JPA objects, etc., depends on the name of the Application.java package.
If the repositories or JPA entities are not in subpackages of the Application.java package, then we must specify them explicitly as follows:
@Configuration @ComponentScan(basePackages="com.sivalabs.jcart") @EnableAutoConfiguration @EnableJpaRepositories(basePackages="com.sivalabs.jcart") @EntityScan(basePackages="com.sivalabs.jcart") public class Application{ public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
With the above optional @EnableJpaRepositories , @EntityScan above, I can run it using Run as> Java Application .
But still not sure how it works fine when run as β spring Boot application !!
In any case, I think it's better to port the Application.java package to com.myapp , and not fight SpringBoot!
source share