Can Windsor work with another IoC container?

At the core of our application, we use Castle Windsor to manage our dependencies. We will download plugins from third parties that can use their own IoC containers. We would like them to get kernel dependencies, for example. through the installation of the designer of basic services, but also get dependencies on their own IoC container.

It seems that if they provided a service provider interface, Windsor could use it to resolve unknown dependencies, ignoring the results (since the lifetime of these components is someone else's business) and continue shipping.

But I'm also sure that there are some great subtleties that arise when you try something like this.

+6
source share
1 answer

It's not needed. If you enable these plugins to use Constructor Injection to get the appropriate services from your host application, Castle Windsor may plug in the plugin correctly. PlugIns simply use the Injection constructor as a way to statically declare a dependency , so while Windsor can resolve the dependency, PlugIn will receive it.

What happens inside each plug-in (including the use of other containers) is not related to the host application.

+6
source

Source: https://habr.com/ru/post/887994/


All Articles