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

Spring default behavior for lazy-init

The default behaviour is false: By default, ApplicationContext implementations eagerly create and configure all singleton beans as part of the initialization process. Generally, this pre-instantiation is desirable, because errors in the configuration or surrounding environment are discovered immediately, as opposed to hours or even days later. When this behavior is not desirable, you can prevent … Read more