在上下文创建期间,spring是否为懒豆解析属性占位符?

编程入门 行业动态 更新时间:2024-10-27 17:12:25
本文介绍了在上下文创建期间,spring是否为懒豆解析属性占位符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个像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是否为懒豆解析属性占位符?

本文发布于:2023-11-11 04:56:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577435.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:下文   在上   属性   spring

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!