Thanks for the reply. Its not what I am after though. We have AXIS2 as part of our web application. We have web services which are defined as beans in the Spring application context loaded as part of the web application.
We also want our modules defined as beans from the same application context. For example our logging module requires a datasource. This datasource is already defined in Spring for the web application. I suppose I am trying to avoid having to setup things twice in 2 different places. Thanks Paul -----Original Message----- From: robert lazarski [mailto:[email protected]] Sent: 16 December 2008 13:37 To: [email protected] Subject: Re: Axis2 module + Spring On Tue, Dec 16, 2008 at 7:52 AM, Paul French <[email protected]> wrote: > Hello All, > > There is support to supply a Spring managed bean as a service using > the ServiceObjectSupplier parameter in the services.xml. However is > there similar support for modules? > > For example I want to log all Soap messages into a database from a > module. I would like to obtain a fully configured module handler from > Spring. Is this possible? > > Thanks > Paul Getting spring setup sort of "anyplace, anytime" like axis2 does is pretty simple, and you could use this ApplicationContextHolder class that comes with the distro. The only thing I'm not sure about with concerning modules is getting a handle to a Classloader reference, since you need either a servlet container or the Classloader from Axis2Service when used to integrate Axis2 services. A module though is totally different and you may not really need to integrate with axis2, just run spring inside of it. In that case, I'd try something like(not tested): public class MyModule implements Module { // initialize the module public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault { ClassLoader classLoader = getClass().getClassLoader(); ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext(new String[] {"applicationContext.xml"}, false); appCtx.setClassLoader(classLoader); appCtx.refresh(); } define this bean as shown in the docs: <!-- Configure spring to give a hook to axis2 without a ServletContext --> <bean id="applicationContext" class="org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder " /> Then every time you need a bean reference: ApplicationContext aCtx = ApplicationContextHolder.getContext(); MyObject = (MyObject) aCtx.getBean("myBean"); HTH, Robert __________ NOD32 3695 (20081216) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com
