Hi,
I know this question may sound silly for some of you but I am new to Spring and I would like to learn the best practices of this powerful framework.

I have the following class that produce a list of objects:

Code:
@Component
public class DataProducer implements ProducerInterface{

    public List<ResultObject> getData(String param) {
            ....
     } 
}
and then I have this other class that should use the list of objects :

Code:
@Component
public class DataConsumer implements ConsumerInterface{
    
    
    private  List<ResultObject> data;

     @Inject
    public void setData(List<ResultObject> data) {   this.data=data; }
    
     public void consumeData() {
            ....
     } 
}
I would like to inject the producer into the consumer but I can't find the best way of doing it. I would like to build something like (ES from a main)

Code:
String param = args[0];
ConsumerInterface consumer = (ConsumerInterface)ctx.getBean(ConsumerInterface.class);
consumer.consumeData();
But the way I have shown you doen't work. One of the problems is that I don't know how to pass the String param to the DataProducer.getData(String param) method!
The second thing is that the Injection does not work and the consumer and the producer are not tied.
Can someone help?
thank you.