Hi everyone,
I am currently using Spring and Struts together. As you know the ApplicationContextAware interface has the method setApplicationContext() which the app context calls, allows the use of app contexts (resources, events etc) - but it ties you to spring. I have read numerous articles, mission statements, and books that clearly state that you shouldn't tightly couple yourself to spring (for obvious reasons). Namely, having your objects implement ApplicationContextAware would do just that. However, these articles don't go on to demonstrate how to prevent tight coupling to the framework AND still preserve context information across various tiers (outside the container). I am utilizing Spring's IOC services by using a ContextLoaderListener and making calls in my struts action code within the container. All of this works fine. However, when I have to leave the container and make a call to my business tier, I need to preserve the context. The problem that I am finding, is that there is little documentation demonstrating how to ensure contextual information is preserved from the webtier (within the container) to the app tier (outside of the container) with out having to either:
1.)decorate the interfaces with a helper object that would otherwise wrap information normally kept in the context
2.)have every object implement applicationContextAware interface - which would tightly couple me to Spring.
3.)have a common service object (that all spring-i-fied objects would extend) - another form of tight coupling.
4.)code directly against the XMLBeanFactory (programatic approach to integrating with spring)
Your help is appreciated.
-Justin


Reply With Quote