Category "dependency-injection"

Create class and auto-initialize dependencies with FakeItEasy

Is it possible to create a class under test with FakeItEasy, where all dependencies that are declared in the constructor are initialized automatically with fake

Is it possible to inject a specific configuration class bound as a suboption and not to IConfiguration<MyType>?

I have a class that I want injected into some controllers. It has a few dependencies that I want to be automatically injected. Specifically this class requires

ASP.NET Core Dependency Injection error: Unable to resolve service for type while attempting to activate

I created an .NET Core MVC application and use Dependency Injection and Repository Pattern to inject a repository to my controller. However, I am getting an err

Dagger @Reusable scope vs @Singleton

From the User's Guide: Sometimes you want to limit the number of times an @Inject-constructed class is instantiated or a @Provides method is called, but y

Is it possible to use Dependency Injection with xUnit?

I have a test class with a constructor that needs an IService. public class ConsumerTests { private readonly IService _service; public ConsumerTests(IS

Best way to override FastAPI dependencies for testing with a different dependency for each test

According to FastAPI official documentation the recommended way to override the dependencies for testing is to do it globally before all tests are run: asy

The right way to DI NpgsqlConnection postgreSQL with multiple connectionString in ASP.NET Core 3.1

I'm struggling to register DI NpgsqlConnection() with multiple connection strings in ASP.NET Core 3.1, Dapper v2.0.78 & Postgres v11. I will provide the cur

Large scale server application using DDD with Python? [closed]

We are preparing to build a large scale server application. To model the logic effectively we're planning to use DDD, including the tactical p

dependency injection with OSGI

I have built an application with the dependency framework Guice. Now I will move over to OSGI and started to extend my jars with bundle information. The main p

Can someone provide a good explanation of Dagger 2?

I'm really having a hard time understanding the Dagger 2 Dependency injection system. I understand the use of the @Inject annotation to tell Dagger we need to

Apache Spark - Is it possible to use a Dependency Injection Mechanism

Is there any possibility using a framework for enabling / using Dependency Injection in a Spark Application? Is it possible to use Guice, for instance? If so,

How to replace a registered service with a new one in MVVM?

Trying to migrate from good old MVVM Light to Windows Community Toolkit. How are we supposed to override a registered service, i.e. replace it with another impl

Unable to resolve service for type while attempting to activate

In my ASP.NET Core application, I get the following error: InvalidOperationException: Unable to resolve service for type 'Cities.Models.IRepository' while atte

Injecting AuthenticationStateProvider into an API Controller in a Blazor Server app

In a Blazor Server app, I have an api controller class that handles file uploads. It works fine (uploads succeed) until I try to inject a custom data service th

WELD-001408: Unsatisfied dependencies for type Customer with qualifiers @Default

I'm a Java EE-newbie. I want to test JSF and therefore made a simple program but can not deploy it. I get the following error message: cannot Deploy onlineshop

Where to place business logic layer in relation to data access while providing unit testability by dependency injection?

I am looking for a way to have a separate layer of business logic in a MVC4 app with Entity Framework, without having to inject my (real or fake) database conte

Spring JUnit: How to Mock autowired component in autowired component

I've got a Spring component I'd like to test and this component has an autowired attribute which I need to change for the purpose of unit testing. The problem i