简体   繁体   中英

Does spring resolve property placeholders for lazy beans during context creation?

I have a bean definition like spring xml context file

<bean id="idFilter" class="some.package.app.filter.IdFilter" lazy-init="true">
    <constructor-arg type="java.lang.String" value="${id.start}"/>
</bean>

Does spring try to resolve the property ${id.start} while building context?

I would assume since idFilter is lazily loaded, the property id.start will not be tried for resolution till the bean is being used.

Is it right?

After carefully debugging the code, I found that placeholders are resolved even for the lazy beans while creating bean definitions.

Please note, bean definitions are not bean instantiation.

So, if the placeholder is not found, an error is thrown for all beans regardless of bean being lazy or eager

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM