Skip lazy init for beans that explicitly set lazy to false

This commit also adds tests to ensure that the child
management context works when lazy initialization is
enabled. Also, it adds a BeanFactoryPostProcessor to
the child context so that the server is created and
listening for requests but other beans in the child
context are not created until requested.

See gh-16184
This commit is contained in:
Madhura Bhave
2019-04-04 15:39:48 -07:00
parent ff1e5076dc
commit ce0282406f
6 changed files with 166 additions and 21 deletions

View File

@@ -119,6 +119,10 @@ on `SpringApplicationBuilder` or the `setLazyInitialization` method on
spring.main.lazy-initialization=true
----
TIP: If you want to disable lazy initialization for certain beans while using lazy
initialization for the rest of the application, you can explicitly set their lazy attribute
to false using the `@Lazy(false)` annotation.
[[boot-features-banner]]