开发者

spring: how to add a property of a bean as a constructor arg

开发者 https://www.devze.com 2023-03-26 06:59 出处:网络
I have a bean (bean1) which has a method called getProperties() I开发者_运维知识库 need to pass the value of getProperties() as a constructor arg of another bean

I have a bean (bean1) which has a method called getProperties()

I开发者_运维知识库 need to pass the value of getProperties() as a constructor arg of another bean

Something like:

<constructor-arg ref="bean1.properties"/>

which does now work. How can I do it?

Thank you very much


You could use the Spring Expression Language for this.

Example:

<constructor-arg value="#{bean1.properties}"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消