I have a @Service class which is called from a web request.
It has a constructor which initializes the list of objects of an implemented type
private List<Interface> interfaceServices;
@Autowired
public ValidateInterfaceService(List<Interface> interfaceServices) {
this.interfaceServices = interfaceServices;
}
This works as intended except if one of the items in the list has a constructor.
@Service
@Order(3)
public class EvaluateExampleWithConstructor implements Interface {
private LocalDate busDate;
@Autowired
public EvaluateExampleWithConstructor(LocalDate busDate) {
this.busDate = busDate;
}
If I try and have this class on the list the code cannot run as "no default constructor is found"
If the value passed into the constructor is needed for the method how do I initialize this list correctly?