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

Are there IDE tools that analyze and/or display dependency graphs?

I'm using ninject (though am willing to switch) and was wondering if there were tools that might help me spot "bad" implementations or present visuals of existing dependencies. The latter would be certainly helpful for design meetings.
1
vote
2 answers

Spring NON MVC project configuration - Best Practices

I am going to work on a Java project and want to use Spring IOC for bean management. This is not a web project but just a simple java project that will give me a jar file at the end. My questions is that, in my application i want to use Spring IoC…
neel4soft
  • 507
  • 1
  • 4
  • 12
1
vote
1 answer

MvvmCross: IoC with Decorator pattern, two implementations of the same interface

I'd like to implement the Decorator pattern in one of my Mvx projects. That is, I'd like to have two implementations of the same interface: one implementation that is available to all of the calling code, and another implementation that is injected…
chkimes
  • 1,127
  • 13
  • 20
1
vote
1 answer

Is is possible to use a custom resolver instead of the hubname attribute to resolve signalr hubs?

All of my SignalRHubs have their own service interface, this is used on the client side for type safe calling; ie no more referring to methods by string. Anyways with this setup I have had to add a HubName attribute to all my hubs with the Interface…
user1618236
1
vote
1 answer

Laravel IoC Multiple Subclasses Bindings: how to make sure it'll be resolved correctly

The title would be vague due to my English. Hope someone can improve it. Here is the thing: I have one abstract class Validator. Currently, I have two subclasses, LoginValidator and SignupValidator , which extend from Validator. I have two services:…
Jesse
  • 231
  • 7
  • 17
1
vote
1 answer

Convert Castle Windsor xml config to C# code

I want to convert something like this:
JasonRShaver
  • 4,344
  • 3
  • 32
  • 39
1
vote
1 answer

How to register dependency for signalr hub using TinyIocContainer within NancyFx

I'm a little new to NancyFx and TinyIoc, but here goes: I have been able to use auto registration of TinyIocContainer within NanxyFx to inject dependencies in Nancy Modules which is very neat, thats all fine and working. But, how do you register a…
Chuen Lee
  • 353
  • 4
  • 17
1
vote
0 answers

Is there a common interface for registering IoC components? (think CommonServiceLocator but for registering)

The Common Service Locator is a great interface to program against for retrieving registered instances in an IoC container. I've built a convention-based tool that registers instances with an IoC container, and I want it to be container agnostic. Is…
Jason Young
  • 3,683
  • 4
  • 32
  • 39
1
vote
0 answers

Using PerThreadLifetimeManager and InjectionFactory

Could someone please explain the result of the following sample code. The question is why the resolved thread id in the ThreadContext does not match with the current managed thread id? Is the result from the InjectionFactory cached and shared…
1
vote
1 answer

Unity with interface that extends another interface

I have a class: public class Foo : IFoo { } and two interfaces: Public interface IFoo : IBar { } public interface IBar { DoSomething(T t); } We are using XML Config,the code configuration works fine, but the web.config…
1
vote
1 answer

Interface laravel doesn't bind why?

Hello guys I was creating a package and i was trying to implement a dependency injection on my class without success. I followed all the instruction for do it work. I'm getting crazy on it. When i try to call Player::team_players(2); it throw me…
Fabrizio Fenoglio
  • 5,767
  • 14
  • 38
  • 75
1
vote
1 answer

Dependency injection - Call to undefined method - Laravel 4

I have a Facade Player where i set up a function info, this function will give me the information of the players, the my issue is when i call that function by dependency injection it throw me the error: Call to undefined method…
Fabrizio Fenoglio
  • 5,767
  • 14
  • 38
  • 75
1
vote
2 answers

Using Ninject to inject dependencies into externally constructed objects (user control)

I would like to use Ninject in my WinForms application. I cannot figure out how to use it for my user controls. Sometimes they rely on the services I want to configure through the DI framework. These controls need to be manageable through the…
Nathan
  • 1,824
  • 1
  • 21
  • 34
1
vote
1 answer

Autofac model binding provider in Web API 2

How do you use the model binding extensions in Autofac for Web API 2? In my container, I've tried this: builder.RegisterWebApiModelBinders(Assembly.GetExecutingAssembly()); builder.RegisterWebApiModelBinderProvider(); I have the following model…
1
vote
2 answers

NHibernate Session DI from StructureMap in components

I know this is somewhat of a dead horse, but I'm not finding a satisfactory answer. First let me say, I am NOT dealing with a web app, otherwise managing NH Session is quite simple. I have a bunch of enterprise components. Those components have…