求助关于CXF整合SSH2框架之后依赖注入为空的问题,如果不注入bean是可以正常使用的,但所有注入的dao都是null,网上的帖子也搜了不少,也有专门说这个问题的,说是要加上<jaxws:implementor ref=""/>,但好多帖子上的方法都试过了,问题依然存在接口:
package com.payment.cxf;import javax.jws.WebService;@WebService
public interface CheckLogin { /**
 * 用户登录验证,返回一个字符串
 * 
 * @param username
 * @return
 */
public String checkLogin(String account, String password, Integer iid);

}实现类
package com.payment.cxf.impl;import javax.annotation.Resource;
import javax.jws.WebService;import org.springframework.stereotype.Component;import com.payment.cxf.CheckLogin;
import com.payment.dao.UserDao;
import com.payment.model.User;/**
 * WebService实现类.
 * 
 * 使用@WebService指向Interface定义类即可.
 */
@WebService(endpointInterface = "com.payment.cxf.CheckLogin")
@Component(value="checkLoginImpl")
public class CheckLoginImpl implements CheckLogin { private UserDao userDao; public UserDao getUserDao() {
return userDao;
} @Resource
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}

public String checkLogin(String account, String password, Integer iid) {
User user = userDao.load(account, password, iid);
if (user != null) {
return "ok";
} else {
return "error";
}
}}
配置文件:<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/aop
           http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<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" />
<import resource="classpath:services.xml" />
<import resource="classpath:security.xml" />
<import resource="classpath:spring-struts.xml" />
<import resource="classpath:dwr.xml" />
<import resource="classpath:ws-context.xml" />
<import resource="classpath:wssec.xml" />
<context:annotation-config />
<aop:aspectj-autoproxy />
<context:component-scan base-package="com.payment,com.payment.cxf" /> <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean> <bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean> <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.payment.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
     <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.connection.isolation">2</prop>
</props>
</property>
</bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean> <bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <aop:config>
<aop:pointcut id="bussinessService"
expression="execution(* com.payment.service..*Service.*(..))" />
<aop:advisor pointcut-ref="bussinessService" advice-ref="txAdvice" />
</aop:config> <tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="load*" read-only="true" propagation="REQUIRED" />
<tx:method name="uc*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>

</beans><?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:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

<jaxws:endpoint id="checkLogin" implementor="com.payment.cxf.impl.CheckLoginImpl" address="/CheckLogin">
        <jaxws:implementor ref="#checkLoginImpl"/>
    </jaxws:endpoint>
    
</beans>
求高手帮忙找下问题出在哪,万分感谢!