I am fairly familiar with concepts of service locator and dependency injection, but there is one thing that gets me confused all the time, i.e., to implement dependency injection for an application we must use some sort of service locator at the star
So I'm implementing a Dependency Injection framework into my Java project (Google Guice) and everything is pretty good, I like it but there's a small problem; I want to make a static instance of my main project's class (where it instantiates the depe
I've been doing MVC for several months now, and I store everything in my $registry object. When I create a new class, I only ever pass the registry usually, but I'm having to constantly pass the $this->registry when creating a new class. e.g. class s
I need to be able to pass a connection string into some of my service implementations. I am doing this in the constructor. The connection string is configurable by user will be added the ClaimsPrincipal as a Claim. All fine so far. Unfortunately, I a
I have a provider: @SuppressWarnings({ "rawtypes", "unchecked" }) @Provides @Singleton @OutboundBroker public EventBroker outboundBrokerProvider() At runtime, I want to get this one. EventBroker outbound=injector.getInstance(Key.get(Ev
I´m trying to configure a Bean to be used in a Spring MVC Controller app using the @Bean annotation. As far as I know, the @Bean annotation is equivalent to the tag in XML configuration. What I am doing is the following: The class with the configurat
Especially in unittests we use this "design pattern" I call "get class from class level" framworktest.py: class FrameWorkHttpClient(object): .... class FrameWorkTestCase(unittest.TestCase): # Subclass can control the class which gets u
So thanks to ng-annotate, now we can minify our code successfully when it looks like this: angular.module('YeomanApp') .controller('YeoCtrl', function ($scope) { $scope.awesomeThings = [ 'HTML5 Boilerplate', 'AngularJS', 'Karma' ]; }); Are there any
I am reasonably new to Autofac and have come up against a problem when injecting dependencies that have arguments that are only known at runtime. (the code below is an example of the problem I am trying to describe). Here is where I setup my containe
I have an MVC4 project in which I am using Ninject as the DI Framework. The problem I am having is trying to split my DI bindings from my implementation as i do not want my main web project to reference all of my other projects. I have tried to creat
At the moment I am experimenting a little bit with dependency injection containers, this time with Unity. Given the following interface: public interface IPodcastCommService { void Download(); void Upload(); } and the following implementation: public
I'm developing and application and I use NInject framework to solve dependencies problems but the constructors is too big. Some constructors have 5, 8, 10 parameters. and for solve this I have an Idea.. Instead code class like this. public class User
I'd like to reduce the boilerplate needed to bind these akka actors. At current, my code looks like this: bind(classOf[ActorRef]). annotatedWith(Names.named("mines")). toProvider(new TypeLiteral[ActorProvider[MyActor]]() {}). asEagerSingleton()
I have an FTP utility responsible for the usual FTP stuff: put file, get file, etc. As part of our infrastructure, we require components to retrieve their configuration from a component implementing an IConfiguration interface and to log their entrie
I've got 2 projects, one is a MVC site, the other a class library. The MVC site references the class library. I have an implementation of IWindsorInstaller in the MVC site and the class library. There is no code in the MVC site that directly referenc
I'm newbe in Roboguice, please help. I have an application calss MyApplication in which in onCreate method i initialize some data. Also i have a POJO with buisiness logic which i want to use in my MainActivity (See code snippets below). I need to inj
We're struggling with understanding the difference between these two ways to configure StructureMap. Our understanding is that they should be identical but we get different results between these two lines inside of Initialize: ObjectFactory.Initializ
I'm looking at the controllers in my website, and most of their constructors look like this: public SomeController( IServiceOne serviceOne, IServiceTwo serviceTwo, ILoggingService loggingService, IGeospatialService geoSpatialService) { // copy to cla
I am trying to autowire some beans (for dependency injection) using Spring for a webapp. One controller bean contains another bean which in turn holds a hashmap of another set of beans. For now the map only has one entry. When i run in tomcat and cal
This is a follow up question on the following answer : Parent Object in php class A { protected function doSomeStuff(){ echo 'a method that all children will need to call'; } } class B { protected $_parent; public function __construct($parent) { $thi
What's a good approach for writing unit tests for the following GetMyObjectsFiltered(...) method in a EF4 repository: public static class MyRepository { public static List<MyObject> GetMyObjectsFiltered(string searchFilter) { var myQueryableObjects
I'm using Parsley framework. I'm trying to inject model in custom visual Tree component; private var _model:Model [Bindable] public function get model():Model { return _model; } public function set model(value:Model):void { _model = value; } Build Co
So, let's say I have an interface IThingFactory: public interface IThingFactory { Thing GetThing(int thingId); } Now, let's say I have a concrete implementation that retrieves Things from a database. Now, let's also say I have a concrete implementati
I have an ASP.NET MVC 1 application that uses NHibernate and Castle Windsor for IoC. The controllers have service classes injected, and these service classes handle all the logic and actions required by the app. The service classes have repositories
NOTE: There are 3 questions in here and I did not make separate questions since they are all somewhat related to the same code. I have the following code that registers the connection to my RavenDB in the Application_Start once per the application's
Possible Duplicate: What should be injected as C'tor paramter under DI principles ? I looking into using Castle Windsor for my next project and I trying to understand what objects should go into a dependency container. My initial thoughts were if an
I'm tried to use Dependency Resolver with Unity, and got some problem when my Controller creating. Here example of controller: public class AccountController : Controller { private readonly ICourseService _courseService; public AccountController(ICou
Can someone direct me to a good example of Unity Dependency Injection for WCF services? Any blog or msdn article will also help.This answer gives an example on how to enable DI in WCF with Castle Windsor. Just replace the IWindsorContainer with an IU
here's the default AccountController.cs that's generated by the framework. public class AccountController : Controller { public IFormsAuthentication FormsAuth { get; private set; } public IMembershipService MembershipService { get; private set; } pub
I recently was asked to troubleshoot some performance problems in an application built with Microsoft's Composite UI Application block - specifically that it was taking too long to load. This is built around Microsoft's ObjectBuilder dependency injec