I have a JAX-RS application deployed on Tomcat 7. I am deploying the application on Tomcat without any web.xml file.
I want to use spring for injecting some of the dependencies in my project. I am not using any XML file to configure beans, instead I have created a class and annotated it with @Configuration annotation, which contains all the bean definitions. Now, I am trying to use that bean by annotating a field in a separate class with @Autowired, but the field is null.
How should I make spring work with this setup ?
EDIT:
I was able to initialize spring application context , by creating a web.xml in WEB-INF/ with the following contents.
<web-app>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
I checked the tomcat logs , and verified that the bean is created by spring. But the problem is when I try to use that bean, the field in the class is null.