在我的依赖注入配置文件 - 我不知道(也找不到示例)如何设置成员一些预定义的环境变量文件。Spring.Net DI 如何读取系统环境变量
不能告诉如何在Spring.Net中做到这一点 - 您的帮助将不胜感激。
在我的依赖注入配置文件 - 我不知道(也找不到示例)如何设置成员一些预定义的环境变量文件。Spring.Net DI 如何读取系统环境变量
不能告诉如何在Spring.Net中做到这一点 - 您的帮助将不胜感激。
看一下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>
使用EnvironmentVariableSource
,目前的文档目前有些不足:http://springframework.net/docs/1.3.2/reference/html/objects.html#objects-variablesource。我写了一些额外的文档,他们可能会被包含在构建的下一个2.0版本中。同时,您还可以在Github https://github.com/serra/spring-net-examples/tree/master/Spring.IoCQuickStart.VariableSources上查看此示例代码。
+1你快:) – bbaia