开发者

Spring properties file and spring reference

开发者 https://www.devze.com 2023-03-27 09:37 出处:网络
How to make reference link in properties file. For example, I have spring config: <property name=\"velocityProperties\">

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

精彩评论

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