Category "dependency-injection"

ASP.NET Core IHostedService manual start/stop/pause(?)

I would like to implement a recurring (timed) IHostedService instance in ASPNET Core that can be stopped and started on demand. My understanding is that IHoste

MapStruct not autowiring with Kotlin and Spring Boot, built using Gradle

I have the following parts in my gradle file: apply plugin: 'kotlin-kapt' ... compile("org.mapstruct:mapstruct:1.3.0.Final") kapt("org.mapstruct:mapstr

Are Angular Service Modules still required?

In the angular docs, it lists the types of feature modules that one can implement. One of those being a service module. https://angular.io/guide/module-types

Where is the Balance Between Dependency Injection and Abstraction?

Many Architects and Engineers recommend Dependency Injection and other Inversion of Control patterns as a way to improve the testability of your code. There's n

.NET Core console app Mediatr command handler doesn't get called

I'm facing a problem that Mediatr command handler is not called. I have the following solution structure. Project.sln -> Application layer (.NET standard cl

Is it possible to switch Azure functions standard DI container for another?

Currently I am using DI in azure functions the standard way public class Startup : FunctionsStartup { public override void Configure(IFunctionsHostBuilder b

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