SSH架构整合没有报错,写用例的时候报错了
struts.xml里没任何东西就是引用struts-test.xml这个文件不贴出来了struts-test.xml:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="eva" extends="json-default" namespace="/eva">
<action name="ssh" class="tAction" method="wodeceshi">
<result name="success">test.jsp</result>
</action>
</package>
</struts>
spring配置:
Anti.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"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="tDao" parent="baseTxProxy">
        <property name="target">
        <bean class="com.test.dao.TDaoImpl" autowire="byName"></bean>
        </property>
    </bean><bean id="tAction" class="com.test.dao.TestAction" scope="request">
 <property name="tDao" ref="tDao" />
 </bean>
</beans>Application.xml中的事务管理:
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean> <bean id="baseTxProxy" lazy-init="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="payment*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="create*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="update*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="remove*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="modify*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="save*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="submit*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="edit*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="stop*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
<prop key="boot*">
PROPAGATION_REQUIRED,-java.lang.Exception
</prop>
</props>
</property>
</bean>报错:Unable to load configuration. - action - file:/D:/tomcat/apache-tomcat-7.0.32/webapps/Test/WEB-INF/classes/struts/struts-test.xml:7:55备注:将struts-test.xml中的tAction用完整路劲替换不会报错,但是不会自动创建tDao接口,一直报出tDao空指针异常
web.xml中有
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/*.xml</param-value>
</context-param>
spring的配置文件Application.xml和Anti.xml都在这个目录下
坐等大神
SpringBeanSSH