这是我的类我试图使用这个注释,我为dozerBeanMapper获取null。我也尝试使用其他bean,如Jaxb2Mapper等
@Service("Transformer")
@Scope("prototype")
public class Transformer {
@Autowired
private Mapper dozerBeanMapper;
public Object testMethod(Object wlpData) throws TransformerException {
MbrReq destObject = null;
destObject = dozerBeanMapper.map(request, MbrReq.class);
return destObject;
}
这是我的配置:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sws="http://www.springframework.org/schema/web-services"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
<sws:annotation-driven />
<context:component-scan base-package="com.xxxxx.xxxx.srvc.membership,com.xxxxx.xxxx.interact.membership.request,com.xxxxx.membership.ws,com.xxxxxx.srvc.membership.generated,com.xxxxx.xxxx.service.transform" />
<!-- WSDL Exposed as memberService -->
<bean id="searchMemDemographics" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
<constructor-arg value="/WEB-INF/schema/MemSvc_Binding_HTTP_V0100.wsdl"/>
</bean>
<bean class="org.dozer.spring.DozerBeanMapperFactoryBean">
<property name="mappingFiles">
<list>
<value>classpath:mapping/dozer-global-configuration.xml</value>
<value>classpath:mapping/dozer-bean-mappings.xml</value>
</list>
</property>
</bean>
<oxm:jaxb2-marshaller id="marshaller" contextPath="com.xxxxx.srvc.membership" />
<oxm:jaxb2-marshaller id="reqMarshaller" contextPath="com.xxxxxx.membership.request" />
<oxm:jaxb2-marshaller id="respMarshaller" contextPath="com.xxxxxx.membership.response" />
在web.xml中我有这个
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/membershipApplicationContext.xml
</param-value>
</context-param>
我还缺少什么?
答案 0 :(得分:0)
尝试向bean添加id。
<bean id="dozerBeanMapper" class="org.dozer.spring.DozerBeanMapperFactoryBean">