Questions tagged [dependency-injection]
Dependency Injection is a set of software design principles and patterns that enables you to reduce coupling between components
dependency-injection
26,873
questions
0
votes
1
answer
15
views
How to separate dependency configuration from UI project of an ASP.NET Core Blazor Web App?
I have a Blazor Web App with the Server hosting model in .NET 8 with the WebApplication.CreateBuilder minimal hosting model.
In the solution I use multiple library projects to foster a clean ...
0
votes
0
answers
6
views
Dagger: inject both a class and its subclass
I want to inject a CsvMapper and ObjectMapper from jackson; their relation is that CsvMapper extends ObjectMapper. I am providing them like so:
@Provides
@Singleton
public ObjectMapper ...
0
votes
0
answers
19
views
Quartz Dependency Injection with Net8
I'm working with .NET 8 and Quartz 3.11 following the official documentation, and I've encountered an issue: I can't correctly configure Dependency Injection for a job that implements the IJob ...
-5
votes
1
answer
47
views
Add Log but can't save [closed]
I add a log with async and want to save with async But returns this error:
'Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved ...
0
votes
0
answers
28
views
Angular DI, how does services behave in memory
Recently I've been thinking about services. Mainly about providing them to the 'root'. I've searched the web, chatGpt and google (maybe unsuccesfully - "learn how to google"), but my ...
0
votes
0
answers
22
views
Why is a Thread-Scoped Bean Injected Instead of a Default-Scoped Bean in Spring Boot?
I recently made a change to my Spring Boot project. I initially had a bean without a specific scope. Due to an implementation that uses threads and the occurrence of concurrency issues, I needed to ...
0
votes
0
answers
16
views
Using Moshi in an extension function or injecting it via DI in Android
In Android, I am using an extension function to map a failed network response to my sealed ErrorResponse class.
@JsonClass(generateAdapter = true)
data class ErrorResponse(
@Json(name = "code&...
1
vote
1
answer
39
views
Dealing with DI lifecycles & cached data in a service class
I have a component in my Angular 11 app that uses a specific service class to request address information from a REST API. This service class caches a few observables in a field that relay the API ...
-2
votes
1
answer
23
views
.NET Core | Dependency Injection | instance creation [closed]
We know, the instances are being provided by IoC container. But when will these instances be created for us by the IoC container?
1
vote
0
answers
57
views
Missing classes detected while running R8
I have a multi module project setup like this:
app module
presentation module (Android module)
domain module (Kotlin module)
data module (Android module)
The dependency graph
presentation -> ...
0
votes
0
answers
50
views
Only one endpoint is not intercepted by auth interceptor in Angular 17.2.1
Only the api/authentication/reset-password endpoint is not intercepted. Other endpoints and api/authentication/refresh-token are intercepted via authInterceptor as expected.
// src\app\admin\pages\...
-1
votes
1
answer
28
views
How to inject some but not all parameters
In my team's codebase I see classes that either have all parameters injected (and no constructor arguments) or have nothing injected. However, I'm wondering how to have a class with some injected and ...
-1
votes
0
answers
26
views
Access PHP-DI container inside HTML template files
What is the correct way to access PHP-DI container inside template files?
For instance, if I need to access User class that can output HTML
<?php
<div>
<?php $container->get('User')-...
0
votes
1
answer
25
views
How to do self-contained Lazy Initialization using async/await
I am trying to initialize a class asynchronously using dependency injection. I have seen this article https://blog.stephencleary.com/2013/01/async-oop-2-constructors.html
but I am trying to initialize ...
-1
votes
1
answer
30
views
ServiceImpl defined in a dependent jar library is not found by spring in MainApplication
I have created a springboot application which will serve as a library for my MainApplication. This library has some service class, repository class and entity, basically an independent feature which ...