我有一个像spring xml上下文文件这样的bean定义
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>spring在构建上下文时是否尝试解析属性 $ {id.start} ?
Does spring try to resolve the property ${id.start} while building context?
我假设由于 idFilter 是延迟加载的,因此在使用该bean之前,不会尝试使用属性 id.start 进行解析.
I would assume since idFilter is lazily loaded, the property id.start will not be tried for resolution till the bean is being used.
对吗?
推荐答案在仔细调试代码之后,我发现在创建bean定义时,即使对于懒惰的bean,也可以解析占位符.
After carefully debugging the code, I found that placeholders are resolved even for the lazy beans while creating bean definitions.
请注意,bean定义不是bean实例化.
Please note, bean definitions are not bean instantiation.
因此,如果未找到占位符,则所有bean都会抛出错误,无论bean懒惰还是渴望
So, if the placeholder is not found, an error is thrown for all beans regardless of bean being lazy or eager
更多推荐
在上下文创建期间,spring是否为懒豆解析属性占位符?
发布评论