I am trying to port an application written using CURAM to a Struts2 project. We use Spring to take advantage of database transaction capabilities. Do as the application code is written in a CURAM application, I cannot use the Injection Dependency function for Spring. I need to access ContextTools Spring from anywhere in my business logic. And creating a new instance of ApplicationContext whenever I need it, it grinds everything to a pause.
I found this resource on the Internet that shows you how to create a static singleton instance of Spring ApplicationContext.
Access Spring -ApplicationContext everywhere in the application
This will solve my problem, but I have problems. Would a static singleton instance mean that every user invoking the Struts2 action would retrieve business objects from a single ApplicationContext instance?
By default, Spring beans are single point in an ApplicationContext instance. Because of this, I think that a static singleton instance of ApplicationContext will cause all user objects to use the same instance of all business objects, which can ruin transactions and probably cause locks everywhere. Am I accepting this right?
What if I declare all my Spring beans a prototype? Will I be able to take advantage of the Springs / Concurrency database transaction processing capabilities when using a static-singleton ApplicationContext instance?
Thank.