What is the default initialization of spring beans in 5? Lazy or not?

What is the default initialization of beans in spring 5 using javaConfig and annotation? Lazy or not?

PS And please give a link to the source (preferably official documentation) where this is clearly written
March 12th 20 at 08:41
2 answers
March 12th 20 at 08:43
Solution
Hello!

According to this answer to the question -
https://stackoverflow.com/questions/15092898/sprin...

The default is no.
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 pre-instantiation of a singleton bean by marking the bean definition as lazy-initialized. A lazy-initialized bean tells the IoC container to create a bean instance when it is first requested, rather than at startup.
March 12th 20 at 08:45
The default is no. For the lazy initialization is @Lazy together with @bean to lazy initialize the specific Bina, or in conjunction with @Configuration for all bins

Find more questions by tags SpringJava