日期:2014-05-17  浏览次数:20772 次

求助,关于Spring声明式事物和Log4j同时配置问题
求助,关于Spring声明式事物和log4j同时配置问题,该怎么样配置呀,请看我的源代码ApplicationContext.xml的配置,我就不知道怎么配置日志。。。。而且我也写了个日志通知,但就是不知道怎么配置。。。。。


<!-- 数据库配置 -->
<bean id="dateSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:sqlserver://localhost:1433;datebaseName=test</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>123</value>
</property>
</bean>

<!-- 配置SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dateSource"/>
</property>
<property name="mappingResources">
<list>
<value>com/accp/bank/orm/Account.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean>
<!-- 事物管理器 -->
<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>

<!-- 事物的控制 -->
<tx:advice id="txAdvice" transaction-manager="hibernateTransactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="load*" read-only="true"/>
<tx:method name="list*" read-only="true"/>
<tx:method name="do*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
 
<!-- 自动代理 -->
<aop:config>
<!-- 切入点 -->
<aop:pointcut id="pointcut" expression="execution(* *..*Biz.*(..))"/>
<!-- 关联切入点和事物特性 -->
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut"/>
</aop:config>

<!-- 注入DAO -->
<bean id="accountDao" class="com.accp.bank.dao.impl.AccountDAOBizImp">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!-- 注入service -->
<bean id="accountBiz" class="com.accp.bank.service.impl.AccountBizImpl">
<property name="accountDao">
<ref local="accountDao"/>
</property>
</bean>
<!-- 注入action -->
<bean name="accountAction" class="com.accp.bank.web.action.AccountAction">
<property name="accountBiz">
<ref local="accountBiz"/>
</property>
</bean&