回答

2

看一下VariablePlaceholderConfigurer对象。它应该做的工作: http://www.springframework.net/doc-latest/reference/html/objects.html#objects-variablesource

<object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core"> 
    <property name="VariableSources"> 
     <list> 
     <object type="Spring.Objects.Factory.Config.EnvironmentVariableSource, Spring.Core"/> 
     </list> 
    </property> 
</object> 

<object type="MyObject"> 
    <property name="MyProperty" value="${MyEnvironmentVariableName}"/> 
</object> 
相关问题