Spring Boot: autowire beans from library project

Just found the solution. Instead of defining base packages to scan from separate library, I’ve just created configuration class inside this library with whole bunch of annotation and imported it to my main MyApplication.class: package runnableProject.application; import com.myProject.customLibrary.configuration.SharedConfigurationReference.class @SpringBootApplication @Import(SharedConfigurationReference.class) public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } package … Read more

getServletConfigClasses() vs getRootConfigClasses() when extending AbstractAnnotationConfigDispatcherServletInitializer

A Bit on ApplicationContext Hierarchies Spring’s ApplicationContext provides the capability of loading multiple (hierarchical) contexts, allowing each to be focused on one particular layer, such as the web layer of an application or middle-tier services. One of the canonical examples of using hierarchical ApplicationContext is when we have multiple DispatcherServlets in a web application and … Read more