81,092
社区成员
发帖
与我相关
我的任务
分享
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml,/WEB-INF/cxf.xml</param-value>
</context-param>
<servlet>
<servlet-name>Dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>CXFWebService</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFWebService</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
applicationContext.xml配置代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsdd">
<!-- 配置Bs -->
<bean id="userBS" class= "com.pms.bs.impl.UserBSImpl">
<property name="userDao">
<ref bean="userDao" />
</property>
</bean>
<bean id="photoBS" class= "com.pms.bs.impl.PhotoBSImpl">
<property name="photoDao">
<ref bean="photoDao" />
</property>
</bean>
<bean id="categoryBS" class= "com.pms.bs.impl.CategoryBSImpl">
<property name="categoryDao">
<ref bean="categoryDao" />
</property>
</bean>
//省略……
</beans>
cxf.xml配置:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<!--导入与CXF框架有关的xml-->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!-- webservice配置 -->
<bean id="photoService" class="com.pms.ws.impl.PhotoServiceImpl"></bean>
<jaxws:endpoint id="photoWS" implementor="#photoService" address="/photo"></jaxws:endpoint>
</beans>
结果这时又出现问题,定义的bean无法自动注入。
真是头疼,该如何解决呢?谁有遇到过的,帮忙解决下!