og4j:WARN No appenders could be found for logger (org.springframework.context.support.FileSystemXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/Administrator/AppData/Local/Genuitec/Common/plugins/com.genuitec.org.hibernate.eclipse_3.2.4.CR1-me201003101716/myeclipse-data/3.3/lib/required/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/Administrator/Workspaces/MyEclipse%208.5/myEdition/WebRoot/WEB-INF/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Exception in thread "main" java.lang.ClassCastException: org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator cannot be cast to com.myEdition.dao.UserDAO
at com.myEdition.action.RegeditAction.main(RegeditAction.java:89)
------------------------------------------------------------------------------------------------
下面是配置:
<?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/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-p-3.0.xsd
">
<!-- 启用自动扫描
<context:component-scan base-package="com.myEdition"></context:component-scan> -->
<!-- 事务管理 -->
<!-- 以下的被注释
<tx:annotation-driven transaction-manager="transactionManger"/>
<bean id="transactionManger" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
-->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/myedition">
</property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"></ref>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<!-- <value>com/myEdition/bean/Content.hbm.xml</value>
<value>com/myEdition/bean/Contenttype.hbm.xml</value> -->
<value>com/myEdition/bean/User.hbm.xml</value></list>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<!-- 配置事务拦截器 -->
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<!--事务拦截器BEAN需要依赖注入一个事物管理器 -->
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<!-- 定义事物传播属性 -->
<props>
<prop key="delete*"> PROPAGATION_REQUIRED</prop>
<prop key="insert*"> PROPAGATION_REQUIRED</prop>
<prop key="update*"> PROPAGATION_REQUIRED</prop>
<prop key="save*"> PROPAGATION_REQUIRED</prop>
<prop key="find*"> PROPAGATION_REQUIRED</prop>
<prop key="get*"> PROPAGATION_REQUIRED</prop>
<prop key="*"> PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 定义BeanNameAutoProxyCreator,该bean是个bean后处理器,无需被引用,因此没有id属性
这个bean后处理器,根据事务拦截器为目标bean自动创建事务代理-->
<bean id="userDAOProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<!-- 指定哪些bean自动生成业务代理 -->