All Questions
Tagged with spring dependency-injection
2,746
questions
0
votes
0
answers
10
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
21
views
Spring Boot reinject dependency on the fly when using spring cloud binder
I am trying to reinject a specific dependency at runtime and want to update all the places where this bean is injected as dependency. How can i achieve this?
I was reading more about @RefreshScope, ...
1
vote
2
answers
41
views
Why Field Injection makes NullPointException [duplicate]
Im studying about dependency injections in Spring.
this is example of field injection.
public class OrderServiceImpl implements OrderService {
@Autowired private MemberRepository memberRepository;...
0
votes
0
answers
40
views
How to resolve indirect cyclic dependency issue in Spring
I am working on a spring project and I have two different modules, framework and workFlow.
framework serves as a Framework Module which provides structure and framework and has main class that loads ...
0
votes
0
answers
30
views
Spring refresh an autowired bean during runtime
I have a property that i need to change on the fly.
As beans are created and autowired on startup, even if i change the bean during runtime is not taking into effect.
Ex:
Class serviceA {
Instant ...
0
votes
1
answer
21
views
Spring boot: dependency cycle between beans could not be broken
I am working on creating an Airline website using Spring Boot. I have a Seat class and a Flight class which represent tables in the database. The idea is that whenever a flight is added, seats for the ...
-1
votes
1
answer
43
views
How to access another field in springs @Value
like the title suggests I want to access another fields value using springs @Value annotation.
I want to do this to resolve the fields value by another fields id. Eg.: I have a field id and a field ...
-1
votes
1
answer
27
views
How to inject specific arguments into constructor in spring?
@Component
public class A {
String one;
int two;
public A a = new ("bro",1);
public A b = new ("come",2);
public A(String one, int two) {
this.one = ...
0
votes
0
answers
14
views
Autowired emailService Inteface returns null but only when called internally (requests from outside don't run into this issue) [duplicate]
I have a simple notification server that I'm working on and I have an EmailService interface and an EmailServiceImpl class. The main application class calls an EmailingWorker class, which contains a ...
2
votes
0
answers
1k
views
Messing up with conflict between spring jcl and commons-logging.jar
Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts
I have few lines in my code that are related to ...
0
votes
0
answers
58
views
Is it possible to manage bean injection by generic types in Spring?
I have two entities with same structure, the only difference is they are stored in different tables. So I decided to move their fields to an abstract class:
@Getter
@AllArgsConstructor
@...
0
votes
0
answers
14
views
Liferay DXP Service builder @BeanReference field is null
In my serviceImpl class I create a custom field with the @BeanReference for Dependency Injection as bellow
@BeanReference(type=PersistenceClass.class)
private PersistenceClass persistenceField;
My ...
0
votes
0
answers
32
views
Design Pattern for Dependency-Injected TelnetInputListener implementation?
I'm working on a Spring project using the Apache commons-net TelnetClient. The TelnetClient has a method to register a listener of type TelnetInputListener, which is an interface containing a callback ...
-1
votes
1
answer
551
views
How to do self injection Spring Boot 3+, in order to pass through proxy and apply transactional behavior
I'd like to create a self reference in my service so that I can use it to go through Spring's proxy and apply transactional behavior.
@RequiredArgsConstructor
public class Service {
@Lazy private ...
-1
votes
1
answer
54
views
Can you access @Autowire'd fields through static references?
Let's say you have the following setup:
public class Producer {
public Product produce() { /* Creates some product */ }
}
@Service
public class ProductService {
@Autowired
private ...