Skip to content

Provide a configuration option to enable lazy initialisation #15870

@wilkinsona

Description

@wilkinsona

The bean factory that is used by default in a Spring Boot application performs eager initialisation of all singleton beans. There has been some interest in performing initialisation lazily so we want to provide a configuration option that will allow users to opt in to this behaviour. When enabled, beans will be initialised on first use. In a web application, this will mean that a large number of beans are initialised on first request rather than during the application's startup.

The main benefit of lazy initialisation is that initial startup time is reduced. However, this comes at a cost:

  1. Handling of HTTP requests may take longer while any deferred initialisation occurs
  2. Failures that would normally occur at startup will now not occur until later

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions