257 questions
1 vote
2 answers
990 views
Does SpringBoot makes bean selection based on variable name?
I recently decided to play a little bit with spring's Bean injection. I have tried to provoke my app to fail when there were two, same type, Bean definition but application started to run. I come up ...
2 votes
3 answers
2k views
Injection token for a custom generic component constructor?
I made a generic material autocomplete, which I would like to use for different API data e.g. countries, people, positions etc. Each of these data share common properties: id, name. Hence, I defined ...
0 votes
2 answers
285 views
@Qualifier field versus constructor parameters injection problems in Spring
I have two beans: CheckPassword and CheckEmail @Service("CheckPassword") @Primary public class CheckPassword implements CheckStringInterface { private static final String regex_password ...
2 votes
1 answer
127 views
Ensuring required properties in a class are not null
Having previously worked mostly with private fields in my classes and passing required objects into the constructor, I'm experimenting with using public properties with the required modifier keyword ...
1 vote
1 answer
112 views
How to resolve construct based injection in Jax-RS
I am in jax-rs and write to write simple Test API. While doing this facing difficulties to resolve construct based injection. Following is service configuration. In which 2 services and 1 decorator ...
1 vote
1 answer
710 views
Angular Unit Test: testing component with constructor injection
I am trying to write unit test for the login component below. This component has a constructor with @Inject. How do we test an angular component with @Inject in constructor? Can someone help? Thanks! ...
6 votes
2 answers
320 views
Can Constructor Over-Injection be avoided in Windows Forms?
I have a Windows Form. It contains many controllers: Grids, buttons, and even a TreeView. Events are defined on most of them. For example, there are multiple independent events that query or command ...
3 votes
1 answer
1k views
Is it possible to do constructor injection for lit element service from app consuming the lit element service
I am new to web-component and lit elements. I wanted to see if its possible to inject values from client class to web-component service through constructor injection, like we do in angular spa ...
2 votes
0 answers
361 views
Lit Element Constructor Injection- Inject parameters in the constructor of a lit element service from client app consuming lit element)
I have created a simple lit element bundle file using rollup.config.js. This bundle file is uploaded in NetStorage. I want to inject a value from the client class (angular spa app’s component.ts file) ...
0 votes
1 answer
295 views
Proper use of ILogger<> in an abstract Factory
I have the following scenario in .NET/C#: I have a IMyService that is created via an IMyServiceFactory. public interface IMyServiceFactory { public IMyService CreateMyService(string something); } ...
0 votes
1 answer
496 views
Can WinForms have dependencies injected without using a dependency injection framework?
I've read through many question on dependency injection in WinForms, with this being the most popular one. I was shocked to discover that every example I've seen on this website uses a library for ...
0 votes
2 answers
973 views
How to use Constructor Injection on Spring 3.2.9?
to everybody click my question, thank you(my eng is bad). The spring version Im working on is 3.2.9. And it's been used Field Injection like @Controller @RequestMapping("/test/something") ...
0 votes
0 answers
49 views
How to manage Spring @Value parameters' constuctor injection when explicitly instantiating a new bean?
I have my JWT utils class: @Component public class JwtUtils { private final String jwtSecret; private final int jwtExpirationMs; public JwtUtils(@Value("${app.jwtSecret}") ...
0 votes
0 answers
33 views
Passing constructor parameter throught multiple objects while resolving in AutoFac
i have difficulties getting my registration in AutoFac done. Let`s say i have the following classes class Foo : IFoo { public Foo(string test, IBar bar) {} } class Bar : IBar { public Bar(bool ...
1 vote
1 answer
565 views
Spring Bean od properties Map<String, POJO> in @Configuration class is visible in class when @Bean method is executing, but not in constructor
A have simple @Configuration class: @Data //setters and getters @ComponentScan @Configuration @ConfigurationProperties(prefix = "some.prefix") public class SomeAutoConfig { public ...