27,058 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-2
votes
1
answer
66
views
ASP.NET Core migrating database issue
I am new to ASP.NET Core and C# development, I was following a tutorial that create a web applications and get this error:
Unable to create a 'DbContext' of type 'AppDbContext'. The exception 'Unable ...
1
vote
1
answer
134
views
Boost-DI with concept-based static polymorphism
I'm using Boost.DI, and I've been having a lot of success learning it. However, I ran into a wrinkle that I can't see exactly how to fix.
The following compiles, links and runs as expected:
class CC
{
...
0
votes
2
answers
143
views
Can I use lazy loading with factories?
I have a project which automatically sets up dependency bindings (using PHP-DI) for various database connections based on datasources defined in a configuration file:
// In reality this is loaded from ...
1
vote
1
answer
106
views
PHP dependency injection and PSR LoggerInterface [closed]
I am missing some kind of best practice for implementation of PHP dependency injection and the PSR LoggerInterface.
Currently (without dependency injection) I have created my own LoggerFactory with ...
Best practices
0
votes
0
replies
64
views
Providing System Services through DI
I’m using Koin for dependency injection in an Android app, and I want to provide BluetoothManager through DI.
Right now, I have a module like this:
val bluetoothModule = module {
single<...
1
vote
1
answer
115
views
Constructor-based dependency injection fails when requesting bean via beanFactory.getBean(Command.class, dto) in Spring Boot
I'm migrating from field injection (@Autowired) to constructor-based injection in a Spring Boot application (Java 21), but I'm running into a BeanCreationException when Spring tries to instantiate my ...
Best practices
0
votes
1
replies
46
views
Custom annotation for performing customized injection logic
Spring 5.3
Use case:
I’ve got an annotation
public @interface MyInject {
String region();
String type();
}
I want to use this annotation in a similar fashion to
@Resource("beanName")
but ...
Best practices
0
votes
3
replies
69
views
Most efficient way to manage the lifecycle of HttpClient in many wrapper classes?
Our application is somewhat of a middleman that transforms data from numerous APIs. Initially to simplify things, we wrote a bunch of specific clients which wrap an instance of HttpClient created in ...
Best practices
0
votes
0
replies
29
views
How to get Autofac Instance Per Request semantics in Asp.Net Core while keeping it idiomatic, i.e. not using tagged matching scopes?
In Asp.Net (not Core) we have InstancePerRequest which uses tagged matching child scopes.
In Asp.Net Core they deprecated InstancePerRequest in favour of InstancePerLifetimeScope which as I understand ...
-3
votes
1
answer
114
views
Should one service call another service or use the repository directly? [closed]
I'm learning Clean Architecture and I can't figure this out.
Imagine this scenario: I have a ServiceA that calls its repository:
public class ServiceA : IServiceA
{
private readonly IRepositoryA ...
3
votes
1
answer
115
views
What options exist for ownership/references in Rust dependency injection?
I'm interested in the options for providing ownership or references to dependencies when doing dependency injection in Rust. I don't mean like a DI framework or anything like that, just the general ...
Advice
1
vote
9
replies
106
views
Is it a good practice to maintain separate properties for factories, singletons, and instances in the Service Container?
I'm implementing a simple PHP service container for my personal website blog and want to make sure I'm setting it up correctly. My container has three types of service registration methods:
singleton(...
0
votes
0
answers
65
views
Nest JS dependency injection
I'm trying to fully understand how modules DI works and I'm struggling with one thing.
I have sample app:
-- API MODULE
all controllers here
-- USER MODULE
APPLICATION MODULE
DOMAIN MODULE
...
3
votes
2
answers
126
views
How can I tell if a Spring ApplicationContext has been refreshed without using an event listener?
I have an instance of a Spring ApplicationContext in a method and I need to "probe" it and decide if:
it has been fully refresh()ed at least once so I can be sure that the beanFactory is ...
0
votes
1
answer
135
views
Using MassTransit IScopedClientFactory or IClientFactory inside singleton service
All my request clients are added, as this works (not only the generation of the client, but the client itself - the request is sent using rabbitmq and I get the response as expected):
using var scope =...