dependency-injection

Custom service in extended Http not getting injected

只谈情不闲聊 提交于 2019-12-18 09:39:37
问题 I want to extend the Http provider to intercept all requests that deliver a 403 status to handle an automatic logout. My custom InterceptingHttp should be declared as Http provider, so I don't need to care about a "special" http provider. I have to following: My custom Http provider import { Injectable } from '@angular/core'; import { Request, XHRBackend, RequestOptions, Response, Http, RequestOptionsArgs } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import {

HK2 IterableProvider named method not finding Implementation

烈酒焚心 提交于 2019-12-18 09:35:14
问题 I have a problem trying to inject a contract with two services bound to it. I'm using Jersey, and extending ResourceConfig to configure my app, where I'm binding two different implementations (classes FooImpl1 and FooImpl2 ) to a same contract (interface Foo ), ranking them differently. Each of these implementations is annotated with @Named and its name. In one of my controllers I want to have access to both implementations, so I inject an IterableProvider<Foo> fooProvider . If I do not

Inline Array Annotation - Why two $scopes are used for this code [duplicate]

徘徊边缘 提交于 2019-12-18 09:19:13
问题 This question already has answers here : Why do angularjs controller declaration have this syntax structure? (5 answers) Closed 2 years ago . I'm going through Angular JS Documentation. I'm not able to figure out one line that I mentioned in the below code. Can anyone explain ? script.js : angular.module('scopeExample', []) .controller('MyController', ['$scope', function($scope) { // This line $scope.username = 'World'; $scope.sayHello = function() { $scope.greeting = 'Hello ' + $scope

Binding autofac with webapi using generic repository

蹲街弑〆低调 提交于 2019-12-18 09:03:20
问题 I am trying to use autofac with a repository and I am trying to add a little generics to try reducing the amount of duplicate code I am writing.However I am going round in circles trying to get autofac to work for me So I created a domainservice and interface that handles our the standard crud operations public class DomainService<T>:IDomainService<T> { protected readonly IDomainService<T> Repository; public DomainService(IDomainService<T> repository) { Repository = repository; } public

MVC5, WebAPI2 and Ninject Parameterless constructor error

*爱你&永不变心* 提交于 2019-12-18 08:55:51
问题 So I have the exact opposite problem as MVC5, Web API 2 and Ninject I have a new MVC5/WebAPI2 project, that has both "Controller"s and "ApiControllers". I'm using the latest unstable version of Ninject.Web.WebAPI with no code changes to NinjectDependencyResolve.cs and Ninject.WebCommom.cs (besides binding my dependency) the ApiController's constructor injection works. However, when I call a MVC Controller I get: No parameterless constructor defined for this object. 回答1: The issue is you need

Choose EJB to be injected without recompiling

末鹿安然 提交于 2019-12-18 08:46:29
问题 Imagine you have two implementations of a @Local interface @Local public interface LocalInterface { } @Stateless public class MyFirstImplementation implements LocalInterface { } @Stateless public class MySecondImplementation implements LocalInterface { } And I want to choose, without recompiling the project (that is, at runtime or using an external configuration property) which one (MyFirstImplementation or MySecondImplementation) I want to use. public class MyClass { @EJB LocalInterface

Choose EJB to be injected without recompiling

北城余情 提交于 2019-12-18 08:45:30
问题 Imagine you have two implementations of a @Local interface @Local public interface LocalInterface { } @Stateless public class MyFirstImplementation implements LocalInterface { } @Stateless public class MySecondImplementation implements LocalInterface { } And I want to choose, without recompiling the project (that is, at runtime or using an external configuration property) which one (MyFirstImplementation or MySecondImplementation) I want to use. public class MyClass { @EJB LocalInterface

How to use WPF controls with Simple Injector dependencies

青春壹個敷衍的年華 提交于 2019-12-18 08:26:52
问题 I'd like to use Dependency Injection in a scenario where I have to inject resources into GUI-controls. As that might be the wrong Place, I have some reasons to do it here and not in a view model (eg. I need Window handles and such). Constructor parameter injection seems to be the preferred way. As most of you know WPF controls must have a parameter-less constructors, otherwise the XAML does not work and for the current scenario I love to keep my XAML since it contains some name registrations

How does Gradle resolve the javaee-api dependency to build an EAR?

蓝咒 提交于 2019-12-18 07:24:39
问题 I see that there's an EAR plugin for Gradle. How is it used to build an EAR ? Yes, there's an ear task. To build an EAR with an EJB module there's a dependency on java-ee. How is that dependency resolved? https://virgo47.wordpress.com/2015/05/13/why-gradle-doesnt-provide-provided/ http://www.lordofthejars.com/2015/10/gradle-and-java-ee.html http://www.adam-bien.com/roller/abien/entry/the_only_one_dependency_you I don't mind reading the fine manual -- just please specify a chapter at least

Injecting a primitive property in a base class with Castle Windsor

放肆的年华 提交于 2019-12-18 07:04:38
问题 I have got the following interface definition: public interface ICommandHandler { ILogger Logger { get; set; } bool SendAsync { get; set; } } I have multiple implementations that implement ICommandHandler and need to be resolved. While Castle Windows automatically injects the Logger property, when an ILogger is injected, I can't find a way to configure the SendAsync property to be set to true by Windsor during the creation of new instances. UPDATE The command handlers implement a generic