Skip to content

Track when isLazyInit has been set in AbstractBeanDefinition #22694

@philwebb

Description

@philwebb

As discussed in spring-projects/spring-boot#16184 (comment) it would be useful if @Lazy(false) could be used as signal that lazy initialization has been specifically disabled. This is not currently possible due to the fact that the AbstractBeanDefinition.isLazyInit() method uses a primitive boolean so there is no difference between @Lazy(false) and a missing annotation.

One suggestion made is to offer a getLazyInit method that returns Boolean.TRUE, Boolean.FALSE or null. Alternatively, we could also consider a LazyMode enum that provides ENABLED, DISABLED or DEFAULT as values.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions