My initial answer was accepted, but now I believe that the best answer would be:
Your expression is incorrect, it should be:
<object name="obj1" type="MyTestClass" depends-on="Paths">
<property name="cfg" expression="@(Paths)['cfgFile']"/>
</object>
You can use expression syntax @(object-id-here) to extract an object from a Spring context using an expression .
Edit - below is the response that was accepted
, , app.config. , PropertyPlaceholderConfigurer; . 5.9.2.1.
:
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
</sectionGroup>
<section name="PathConfiguration" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<PathConfiguration>
<add key="cfgFile" value="config.txt"/>
<add key="otherCfgFile" value="otherconfig.txt"/>
</PathConfiguration>
<spring>
<context>
<resource uri="mycongfig.xml"/>
</context>
</spring>
</configuration>
myconfig.xml :
<object name="obj1" type="MyTestClass">
<property name="cfg" value="${cfgFile}"/>
</object>
<object name="appConfigPropertyHolder"
type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
<property name="configSections">
<value>PathConfiguration</value>
</property>
</object>
, app.config IResource.
cfgFile , value-ref (. Spring docs 5.3.2.4 , ). () , , ( ConfigurationObject).