Hi.
Thanks alot! When I created my own ApplicationContextHolder everything worked. Thanks for all your help, much appreciated after this has taken me alot more time then it probably should have.. :) -Az. > Apart from this code, is spring and axis2 running together in your web > service? I thought you said it was. I think I know what your are > asking for, but without knowing what "TavernaBaseProfile" is doing, > I'd be concerned that it creates two separate Spring worlds in your > app - you probably don't want that. Anyways, with that caveat, if you > just need "ApplicationContext" to pass into "TavernaBaseProfile" , I > would do the following: > > Keep axis2 and spring as is, since its working. The idea behind the > axis2 ApplicationContextHolder is a known way to get an > ApplicationContext, and can be used outside axis2. So I think you > should create your own. Its easy, and it seems far less confusing, at > least to me, to use your own ApplicationContextHolder outside of axis2 > when using SpringServletContextObjectSupplier. So you'd need this xml > in your Spring config: > > <!-- Use this trick to get access to Spring beans in junit and other places > that are not spring aware > --> > <bean id="applicationContext" > class="mypackage.spring.ApplicationContextHolder" /> > > > And this class in your app: > > package mypackage.spring; > > import org.springframework.beans.BeansException; > import org.springframework.context.ApplicationContext; > import org.springframework.context.ApplicationContextAware; > > /** Implementation of a Spring interface who is configured in Spring's > * applicationContext.xml or some other Spring type of way. This class > * and the spring bean needed to wire it could be used as an alternative > * to getting the ApplicationContext from the ServletContext. It also can > * be used to get access to spring beans in places like junit that are not > * spring aware. > */ > public class ApplicationContextHolder implements ApplicationContextAware { > > private static ApplicationContext appCtx; > > public ApplicationContextHolder() {} > > /** Spring supplied interface method for injecting app context. */ > public void setApplicationContext(ApplicationContext applicationContext) > throws BeansException { > appCtx = applicationContext; > } > > /** Access to spring wired beans. */ > public static ApplicationContext getContext() { > return appCtx; > } > > } > > Then instead of: > > ApplicationContext context = new > RavenAwareClassPathXmlApplicationContext("context.xml"); > > Do this: > > ApplicationContext ctx = ApplicationContextHolder.getContext(); > TavernaBaseProfile profile = new TavernaBaseProfile(context); > > Good luck, > Robert _________________________________________________________________ Ditt liv. Dine ting. Alt på ett sted med Windows Live™. http://windowslive.no