I have the following main class:
public class Startup implements UncaughtExceptionHandler {
@Autowired
private MessageListener messageListener;
private static Startup startup;
public static void main(String[] args) {
Startup start = new Startup();
start.init(args);
}
public void init(String[] args) {
context = new ClassPathXmlApplicationContext("applicationContext.xml");
startup = (Startup) context.getBean( "startup" );
startup.start(); //here the messageListener is used
}
// here goes the main class that calls the method where messageListener is used }
@Component
public class ProdMessageListener
extends AbstractMessageListener implements MessageListener {...}
and
public abstract class AbstractMessageListener
implements MessageListener {...}
as well as
@Component
public interface MessageListener extends QueueAware {...}
@Component
public interface QueueAware {...}
My Spring context uses to locate all the classes and interfaces. However the bean is not recognized and I get:
No qualifying bean of type [com.ware.messaging.listener.MessageListener] found for dependency.
Any ideas why autowiring does not work?