Skip to main content
Filter by
Sorted by
Tagged with
2 votes
0 answers
110 views

The code in app.module.ts is like so: export function ConfigFactoryInitialize(configService: AppSettingsService): () => Promise<AppSettings> { return () => configService.loadAsync(); } ...
pesho hristov's user avatar
Best practices
1 vote
3 replies
127 views

In both Spring and Angular, there are two common ways to inject dependencies: Constructor injection Field-style injection (@Autowired in Spring, inject() in Angular) In Spring, constructor injection ...
ATW's user avatar
  • 289
Best practices
1 vote
3 replies
114 views

I'm learning about design patterns and I stumbled upon the Decorator pattern. I did my research, and implemented a working version. public interface IWriter{ void Write(string text); } public ...
VVlktor's user avatar
1 vote
1 answer
89 views

I have a Blazor server application. I have an IHostedService that is meant to do startup tasks in the StartAsync() method: builder.Services.AddHostedService<StartupTask>(); It has a constructor ...
Patrik Nusszer's user avatar
1 vote
1 answer
52 views

I am working on an ASP.NET Core Web API and using Redis (StackExchange.Redis) for rate limiting. Redis is running using Docker Desktop, and the container is up and accessible on localhost:6379. ...
SANTHOSH V's user avatar
Best practices
2 votes
2 replies
127 views

I have a Spring Boot application that relies on the default DataSourceAutoConfiguration to create my DataSource bean. I also have a custom bean that must be fully initialized before the DataSource ...
Harry Yang's user avatar
Best practices
1 vote
5 replies
114 views

I've been using Java and Google's Dagger2 dependency injection, and contemplating how to implement similar Dependency Injection in C++ with little-to-no overhead. One stumbling block I've found is ...
Mooing Duck's user avatar
  • 67.7k
1 vote
2 answers
196 views

I am getting the following error when starting my app: System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: ...
Dean P's user avatar
  • 2,331
1 vote
1 answer
93 views

I'm building an API with Slim 4 and want to use the pattern Controllers/Services/Models, but I'm having some difficulties with dependency injection. For the sake of example, I have these endpoints : $...
Lysgard's user avatar
  • 53
0 votes
0 answers
37 views

I have a multi-module project, jsonHelper is defined in the common module, added as dependency to the orchestrator module, but ObjectMapper is not autowired in the orchestrator module. I got this ...
mari's user avatar
  • 417
0 votes
0 answers
41 views

I'm having issues with dependency injection in my NestJS E2E tests using Vitest. The ConfigService works perfectly when running the application locally, but it's undefined when providers try to use it ...
VitorMendonca62's user avatar
2 votes
1 answer
80 views

Introduction I'm currently migrating some projects from Keycloak Angular v18 to v19, with its big rework. One of the changes is that you now have to use the provideKeycloak() method in the providers ...
Panossa's user avatar
  • 437
Best practices
0 votes
1 replies
42 views

Which is a better approach to follow in fast api to add dependency to the router or function ? check_person_exists will accept the person_id as an input parameter @router.put( "/update-name/{...
Tanu's user avatar
  • 1,712
3 votes
2 answers
83 views

Consider having two types public class TypeA { public TypeA(IEnumerable<IChild> children) { ... } } and public class TypeB { public TypeB(IEnumerable<IChild> children) { ... } } ...
Creepin's user avatar
  • 551
1 vote
0 answers
71 views

Problem When clicking on an ngbDatepicker input to open the datepicker popup, I get the following runtime error: ERROR RuntimeError: NG0203: takeUntilDestroyed() can only be used within an injection ...
Oussama hennane's user avatar
1 vote
0 answers
125 views

I want to authenticate my users with JWT tokens. For this purpose, I write an ISigningKeyRepository that handles rotating and creating signing keys in the database. Now when I want to register JWT ...
Amir Hossein Ohadi's user avatar
-2 votes
1 answer
93 views

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 ...
reham501's user avatar
  • 165
1 vote
1 answer
174 views

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 { ...
Blindy's user avatar
  • 68k
0 votes
2 answers
174 views

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 ...
Cardinal System's user avatar
1 vote
1 answer
128 views

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 ...
Michael Risbjerg Amstrup's user avatar
Best practices
0 votes
0 replies
66 views

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<...
Robert Baricevic-Petrus's user avatar
1 vote
1 answer
147 views

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 ...
Andrea's user avatar
  • 11
Best practices
0 votes
1 replies
51 views

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 ...
St.Antario's user avatar
  • 27.8k
Best practices
0 votes
3 replies
78 views

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 ...
MetallicHydrogen's user avatar
Best practices
0 votes
0 replies
39 views

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 ...
mark's user avatar
  • 63.9k
-3 votes
1 answer
280 views

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 ...
Demian's user avatar
  • 1
3 votes
1 answer
124 views

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 ...
jacobsa's user avatar
  • 8,055
Advice
1 vote
9 replies
114 views

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(...
germanshedder's user avatar
0 votes
0 answers
68 views

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 ...
Pyrkosz's user avatar
  • 48
3 votes
2 answers
158 views

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 ...
Kostas Filios's user avatar
0 votes
1 answer
153 views

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 =...
ZorgoZ's user avatar
  • 3,746
2 votes
1 answer
131 views

I run into a runtime error when using autofac in combination with hybrid cache and redis. I hope someone can explain why this error occurs. When using autofac to resolve an instance of HybridCache in ...
Elzo Lubbers's user avatar
3 votes
1 answer
63 views

I'm trying to call the handle to return values ​​from the application layer. I'm using the mediator pattern. I've tried calling it, but haven't been able to due to lack of experience. The endpoint: ...
Andres Miguel Campos's user avatar
-3 votes
1 answer
88 views

I have the following 2 classes. MyClass composes MyOtherClasses. Each of them requires different ILogger<foo>: public class MyClass { private readonly ILogger<MyClass> _logger; ...
khteh's user avatar
  • 4,366
1 vote
1 answer
148 views

I have a console app constructed using the following code: public partial class Program { private static async Task<int> Main(string[] args) { Host.CreateDefaultBuilder(args) ...
khteh's user avatar
  • 4,366
1 vote
1 answer
59 views

I have a class Handler with interface IHandler that depends on IService, which in turn has two implementations ServiceA and ServiceB. Then I have a class Consumer which depends on Handler and knows at ...
user5717448's user avatar
1 vote
2 answers
112 views

I am building a component library with Angular 19. I created a component MyComponent that uses a service MyInternalService to store some data and interact with them. MyComponent needs an instance of ...
TCH's user avatar
  • 779
0 votes
3 answers
208 views

Say I have this interface: public interface IExample { string GetSupportedExtension(); void DoWork(Stream input); } a concrete implementation like: public class PdfExample : IExample { ...
Kiblinix's user avatar
2 votes
1 answer
148 views

I'm using the Micronaut framework, and using ConfigurationProperties to load application config into an injectable bean. This has worked well so far, but I'm now stuck on loading nested objects into a ...
Kris Harper's user avatar
  • 5,932
2 votes
1 answer
205 views

I'm setting up an Android project, where I've separated the code into different modules to have a bit of a cleaner structure. The modules are presentation, domain, data, di and app. I am including a ...
binkypv's user avatar
  • 65
0 votes
1 answer
94 views

I have the following code in my Program.cs to implement my custom feature provider: builder.Services.AddScoped<IFeatureDefinitionProvider, DatabaseFeatureProvider().AddFeatureManagement()....
Cef's user avatar
  • 959
1 vote
0 answers
86 views

I currently have a ServiceProvider that registers certain types from the current assembly within one container. I am trying to implement a separate prism dialogservice that would register only ...
gwiz_kid's user avatar
  • 143
-1 votes
4 answers
182 views

I'm working on a .NET application where every command/query handler needs access to three shared services: IValidator, ISecurity and ILogger. Rather than manually injecting these into each handler ...
Mahmudul Hasan's user avatar
1 vote
2 answers
126 views

I want to create a repository base class, every service should inherit from this BaseService. This is my code: public class BaseService<TEntity, TAddDto, TUpdateDto, TEntityDto> : IBaseService&...
ross's user avatar
  • 23
1 vote
0 answers
110 views

I have an ASP.NET Core 8 app with a long-lived service that refreshes an in-memory cache on a timer. I registered the service as a singleton (it’s a hosted background worker), and it needs to query ...
Michael Ding's user avatar
1 vote
1 answer
135 views

Consider these model classes: [JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")] [JsonDerivedType(typeof(A), typeDiscriminator: nameof(A))] [JsonDerivedType(typeof(B), ...
aepot's user avatar
  • 4,906
0 votes
2 answers
118 views

I have a .NET 4.7.2 console application that uses .NET Generic Host and has 2 background services. One of them (dependent) should start its work only after another one (base) has completed its ...
bairog's user avatar
  • 3,593
0 votes
0 answers
98 views

The code is used in many projects and works but in one service sometimes an error occurs: "InterfaceError: (sqlalchemy.dialects.postgresql.asyncpg.InterfaceError) <class 'asyncpg.exceptions....
Раенко Тимофей's user avatar
1 vote
1 answer
278 views

C# and .NET 8, using .NET DI framework and IOptions. I have an option class: public class MyOptions { public string Name { get; set; } } Then I have a service class that needs an instance of ...
Kjell Rilbe's user avatar
  • 1,623
0 votes
0 answers
64 views

I have an ASP.NET Web API project using Autofac for dependency injection. I register a factory for creating ICommandExecutor based on an enum: builder.Register<Func<CommandType, ICommandExecutor&...
Pulkit Sharma's user avatar

1
2 3 4 5
542