I have a 3-tier application hosted in Tomcat; web, service and DAO layers.
How do you integrate Tomcat and Spring? I need to make use of Spring’s dependency injection, transaction management, etc.
I can only think of instantiating a ClassPathXmlApplicationContext but this way the ApplicationContext singleton instance is not visible across layers.
If you are creating web application you don’t use
ClassPathXmlApplicationContext. Instead of that you use features of web-container.You define application context in
web.xml.For details take a look into documentation Convenient ApplicationContext instantiation for web applications.
If a bean needs instance of application context, use
ApplicationContextAwareinterface.