I\'m learning Spring and I\'m having some problems trying to set up a relatively basic Spring project. I\'m creating an application to simply read from a database, but I\'m havi
You need to create the application context no matter if you are using xml or annotation based configuration. If your application is a web application, see this post Loading context in Spring using web.xml to load the application context
Once you have the application you can get the bean using context.getBean()
method
Also, spring container does not manage the objects you create using new operator. In your example you need to autowire the GetCustomerEvent bean
@Autowired GetCustomerEvent getCustomerEvent;
//and call
getCustomerEvent.getCustomers();
Problem is with below line
GetCustomerEvent ev = new GetCustomerEvent();
You manually created instance using "new". Spring does not have idea about this object. See Why is my Spring @Autowired field null? for details.
You are not initializing the Spring Container.
You need to create your context in order for it to work.