Questions tagged [ioc-container]

In object oriented languages, an inversion of control container (ioc-container) can be used for configuring and managing objects in an application.

In object oriented languages, an inversion of control container (ioc-container) can be used for configuring and managing objects in an application. The container is responsible for managing object lifecycles (creation, initialization, destruction) and configures objects by wiring them together.

Objects managed by the container obtain references to other objects (their dependencies):

  • by explicitly asking the container, using dependency lookup methods on the container
  • automatically, because the container injects the dependencies using one or more dependency injection techniques

Frameworks that provide an ioc-container support one of these methods and often both.

The following frameworks are discussed here at Stackoverflow

For .NET:

For Java:

2163 questions
1
vote
1 answer

Resolving Unity dependency outside of application start, in libraries

I'm building an ASP.NET MVC app, and implementing Dependency Injection for the first time using Unity. For one particular interface, I've multiple types registered, like so: container.RegisterType("AppfabricCache", new…
Narayana
  • 2,654
  • 3
  • 32
  • 32
1
vote
1 answer

MVC 4 Unity Container and NUnit Test

I need some help setting up an NUnit test for a ASP.net MVC 4 application using Unity Container. I am using a bootstrapper class file to create the Unity Container. Bootstrapper class: public static class Bootstrapper { public static…
alpha
  • 501
  • 2
  • 7
  • 22
1
vote
1 answer

Java lazy instantation using inversion of control container

I have this container: public class DIContainer { protected static DIContainer instance; protected Hashtable, Class> classMap; protected DIContainer(){ this.classMap = new Hashtable, Class>(); } …
Andrius
  • 19,658
  • 37
  • 143
  • 243
1
vote
2 answers

Which IoC framework in .NET has the most complete support for Xml configuration?

I know that Xml for IoC configuration is out of the favor, but I plan to develop some tool support on top of it, so that is the reason for using Xml. Also, I would suspect that Spring .Net could be a good choice, but the project seems to be…
Dan
  • 11,077
  • 20
  • 84
  • 119
1
vote
2 answers

How to use/configure Unity Container IOC in my situation

I have some trouble implementing the Unity IOC into my project reading from config file. Here is what I have 1) ClasslibraryA 2) ClasslibraryB that references ClasslibraryA 3) Winforms App that references ClasslibraryB Note: SomeOther app will…
Joshscorp
  • 1,832
  • 4
  • 22
  • 42
1
vote
4 answers

Autowiring not working outside controller

I am using autowiring in one of my projects. @autowiring is working fine in the controller, but I need to use same autowiring object in some other class, which is used as task class for quartz. Autowiring is not working there. I tried this code…
neel4soft
  • 507
  • 1
  • 4
  • 12
1
vote
0 answers

Using EF with connected POCOs in multi-tier applications

I am developing a multi tier desktop application(Onion architecture), with a WinForm Project as UI, and I used EF code first to access my DB, and for my Domain models, I want to use POCOs, so I have two choices : Connected POCOs Disconnected…
Masoud
  • 8,020
  • 12
  • 62
  • 123
1
vote
2 answers

Auto-Starting and stopping services in Google Guice

I am new to Google Guice after working a lot with Windsor Castle (.NET). I would like to achieve in Google Guice something similar to Windsor Castle Startable Facility (http://docs.castleproject.org/Windsor.Startable-Facility.ashx). This means that…
dux2
  • 1,770
  • 1
  • 21
  • 27
1
vote
3 answers

Are IoC containers about configuration files?

Recently I developed a performance tester console application, with no UI, with the help of a IoC containter (Castle-Windsor-Microkernel). This library enabled me to let the user choose which test(s) to run, simply by changing the configuration…
1
vote
1 answer

Getting Spring IOC to work with the MVP pattern

I'm attempting to use the MVP design pattern with a Swing application in conjunction with Spring IOC. In MVP the View needs to pass itself into the Presenter, and I can't work out how to do this with Spring. public class MainView implements…
Dan
  • 29,100
  • 43
  • 148
  • 207
1
vote
2 answers

Unity to Structure Map

I am trying out the code from this post on Event Driven Architecture (very interesting by the way). His IOC container is Unity though and I would like to do this using Structure map. His code is: public class EventSubscriptions :…
beckelmw
  • 1,722
  • 2
  • 16
  • 23
1
vote
1 answer

Caliburn Micro, dynamically loaded views/viewmodels

I have been playing around with Caliburn Micro for some time. The application that I am working on consists of an MainAppView, MainAppMenuView and MainAppContentView. With corresponding ViewModels. All this works fine. Now in the MainAppContentView…
dlilleaa
  • 77
  • 1
  • 2
  • 10
1
vote
1 answer

Repository and IoC Patterns

Previously I asked this question and on a answer I got this comment: This works, however injecting the container to a part, as far as I know, is not a "normal" use-case of MEF. In my web app I have a few repositories that, of course, retrieve…
Leonardo
  • 10,737
  • 10
  • 62
  • 155
1
vote
2 answers

Unity throwing NotImplementedException "Additional interfaces do not have an implementation." when injecting interface with AdditionalInterface()

I'm trying to use Unity to add an interface on top of an object without touching the existing code base. The goal here is to apply some interceptors to an existing code base by simply configuring it in my application. Things to keep in mind: I am…
1
vote
0 answers

using Ninject in project

I want to use Ninject in my project,this is my code : public class NinjectControllerFactory : DefaultControllerFactory { private IKernel ninjectKernel; public NinjectControllerFactory() { ninjectKernel = new StandardKernel(); AddBindings(); } …