I would like to access beans that i have defined in /WEB-INF/springws-servlet.xml from within my Endpoint handler method. Currently I am resorting to as shown below. Is there a better way to access the context to get the bean within the Endpoint.
ApplicationContext ctx = new FileSystemXmlApplicationContext("webapp/WEB-INF/springws-servlet.xml");
BeanType mybean = (BeanType) ctx.getBean("mybean");
Same thing with the jaxb2marshaller. I have it setup in the springws-servlet.xml. How do I access it in my Endpoint instead of doing
JAXBContext jc = JAXBContext.newInstance("com.test.mypackage");
Marshaller m = jc.createMarshaller();
Below is my webapp/WEB-INF/springws-servlet.xmlwebapp/WEB-INF/springws-servlet.xml
<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
<constructor-arg ref="jaxbmarshaller"/>
</bean>
<bean id="endpointMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"/>
<bean id="jaxbmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>org.hr_xml._3.SyncHRMasterDataType</value>
<value>org.openapplications.oagis._9.ConfirmBODType</value>
</list>
</property>
</bean>
<bean id="mybean" class="com.test.package">
<property name="releaseID" value="1"/>
</bean>
thanks much.
You should just autowire in your dependency within the endpoint: