Hello,
I am trying to find the best way to instantiate a service object once as a singleton and have it used by two consumers - a web app and a web services soapbindingimpl class.
Any recommendations?
Thanks,
Jim M.
Hello,
I am trying to find the best way to instantiate a service object once as a singleton and have it used by two consumers - a web app and a web services soapbindingimpl class.
Any recommendations?
Thanks,
Jim M.
In Spring beans a singleton by default, so in your case the following would do the trick:
Code:<bean id="someService" class="SomeService"/> <bean id="someController" class="SomeController"> <property name="someService" ref="someService"/> </bean> <bean id="someSoapThingy" class="SomeSoapThingy"> <property name="someService" ref="someService"/> </bean>
blog: http://pveentjer.wordpress.com project: STM Implementation http://multiverse.googlecode.com
I understand that. However, In this case, I would need to load the BeanFactory in two places because of the two consumers call my transactional boundary. If I load the BeanFactory in two places would there not be two instances?
Aha ok. I don't think you should load the container twice. If you load the container with the ContextLoaderListener you can access it from the ServletContext.Originally Posted by jimmatts
And you should not worry about concurrent access to that service: that is what the I from ACID stands for: Isolation![]()
Last edited by Alarmnummer; May 26th, 2006 at 06:08 AM.
blog: http://pveentjer.wordpress.com project: STM Implementation http://multiverse.googlecode.com
I don't think the generated Axis code for SoapBindingImpl class has access to the servletContext does it?