Spring boot - Is there a way to create multiple instances of same class within another class by @Autowired annotation?
Here is an example of what I am trying to achieve:
There is util class:
@Component
public class CICSUtil {
.......
}
There is a service class:
@Service
public class Service {
@Autowired
private CICSUtil util1;
@Autowired
private CICSUtil util2;
}
In this service class, I want to create multiple instances of the Util class in a Spring boot project using autowiring approach.
Is there a way I can do that? Please help me out. If not autowiring, let me know if there is an other cleaner way to do this.