Spring.NET lacks recursive dependencies resolution?

204 Views Asked by At

I'm prototyping a WCF project using Spring.NET as the IoC container. It seems like I have to include explicit references to all Spring.NET managed assemblies I use in my IIS web.config.

For example, if my WCF project is referencing Spring.NET managed AssemblyA that is in turn referencing a Spring.NET managed AssemblyB, I have to include the following lines in my config file in order for all dependencies to be resolved:

<spring>

    <context>

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

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


    </context>
</spring>

Can't I package AssemblyA and AssemblyB in a such way that they "bootstrap" themselves, perhaps by using the app.config for each assembly? Forcing a consuming application to have intimate knowledge about the dependencies of it's dependencies seems really smelly to me and contrary to the principles of DI.

I can find no documentation on this.

Many thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

Assemblies don't have an app.config, so no.

I don't know how your code is layed out, but in theory the container should be instantiated in the main dll, so it would make sense that there is where all the configuration resides (or as in this case, where the links to the config pieces reside).