【问题标题】:Spring.NET lacks recursive dependencies resolution?Spring.NET 缺少递归依赖解析?
【发布时间】:2011-02-26 07:37:17
【问题描述】:

我正在使用 Spring.NET 作为 IoC 容器对 WCF 项目进行原型设计。似乎我必须包含对我在 IIS web.config 中使用的所有 Spring.NET 托管程序集的显式引用。

例如,如果我的 WCF 项目正在引用 Spring.NET 托管的 AssemblyA,而后者又引用了 Spring.NET 托管的 AssemblyB,我必须在我的配置文件中包含以下几行,以便解析所有依赖项:

<spring>

    <context>

      <resource uri="assembly://AssemblyA/ApplicationContext.xml"/>

      <resource uri="assembly://AssemblyB/ApplicationContext-Dao.xml"/>


    </context>
</spring>

我不能以它们自己“引导”的方式打包 AssemblyA 和 AssemblyB,也许是通过对每个程序集使用 app.config 吗?强迫一个消费应用程序对其依赖项的依赖关系有深入的了解,这对我来说真的很臭,并且违反了 DI 的原则。

我找不到这方面的文档。

非常感谢。

【问题讨论】:

    标签: wcf inversion-of-control spring.net bootstrapping


    【解决方案1】:

    程序集没有 app.config,所以没有。

    我不知道您的代码是如何布局的,但理论上容器应该在主 dll 中实例化,因此所有配置都驻留在哪里是有意义的(或者在这种情况下,配置文件的链接驻留)。

    【讨论】:

      猜你喜欢
      • 2016-04-26
      • 2011-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-10
      • 2021-10-15
      • 2017-12-25
      • 2015-04-18
      相关资源
      最近更新 更多