现在的位置: 首页 > 综合 > 正文

applicationContext.xml

2014年11月18日 ⁄ 综合 ⁄ 共 2655字 ⁄ 字号 评论关闭

 

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/schem...-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

<description></description>
<!-- ========================= GENERAL DEFINITIONS ========================= -->

<!-- Configurer that replaces ${...} placeholders with values from properties files -->
<!-- (in this case, mail and JDBC related properties) -->
<!--
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/log4j.properties</value>
<value>/WEB-INF/jdbc.properties</value>
</list>
</property>
</bean>
-->


<!-- ========================= BUSINESS OBJECT DEFINITIONS ======================== -->

<!-- Generic validator for Account objects, to be used for example by the Spring web tier -->
<bean id="accountValidator" class="com.tianrui.amusement.domain.logic.AccountValidator"/>

<!-- Generic validator for Order objects, to be used for example by the Spring web tier -->
<bean id="orderValidator" class="com.tianrui.amusement.domain.logic.OrderValidator"/>


<bean id="amusement" class="com.tianrui.amusement.domain.logic.amusementImpl">
<property name="accountDao" ref="accountDao"/>

</bean>


<!-- ========================= ASPECT CONFIGURATION ======================== -->
<aop:config>

<!--<aop:pointcut id="defaultDaoTx" expression="execution(* com.tianrui.amusement.domain.logic.AmusementFacade.*(..))" />
<aop:advisor pointcut-ref="defaultDaoTx" advice-ref="txAdvice"/>-->

<aop:pointcut id="testDaoTx" expression="execution(* com.tianrui.amusement.dao.*.*(..))" />
<aop:advisor pointcut-ref="testDaoTx" advice-ref="txAdvice"/>


</aop:config>


<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="insert*" rollback-for="DataAccessException"/>
<tx:method name="update*" rollback-for="DataAccessException"/>
<tx:method name="delete*" rollback-for="DataAccessException"/>
<tx:method name="get*" read-only="true"/>
</tx:attributes>
</tx:advice>

</beans>

applicationContext*.xml fails to load context files

servletContext = new MockServletContext("");
servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
"/WEB-INF/applicationContext*.xml");

ServletContextListener contextListener = new ContextLoaderListener();
ServletContextEvent event = new ServletContextEvent(servletContext);
contextListener.contextInitialized(event);

抱歉!评论已关闭.