开发者

Spring properties file and spring reference

How to make reference link in properties file. For example, I have spring config:

  <property name="velocityProperties">
       <value> 
         <entry key="ds.r开发者_如何转开发esource.loader.instance">
             <ref bean="databaseVelocityTemplateLoader"/>
         </entry>
         <entry key="ds.resource.loader.resource.table">
             <value>v_template</value>
         </entry>
         <entry key="ds.resource.loader.resource.keycolumn">
             <value>N_ID</value>
         </entry>
       <value>
   </property>

And I want to write this config in file:

ds.resource.loader.resource.keycolumn=N_ID
ds.resource.loader.resource.table=v_template

How to write this ref: ds.resource.loader.instance ?


I'm not sure of a way built into Spring to do this, but you could extend the PropertiesPlaceholderConfigurer and override the convertPropertyValue() method to try to resolve a property value to a bean name before doing the normal property replacement.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜