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.
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 theAbstractBeanDefinition.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
getLazyInitmethod that returnsBoolean.TRUE,Boolean.FALSEornull. Alternatively, we could also consider aLazyModeenum that providesENABLED,DISABLEDorDEFAULTas values.