<?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"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config />
<!-- 根据base-package指定的路径,扫描其下所有包含注解的Bean,并自动注入 -->
<context:component-scan base-package="com.ccc.account" />
<!--正常的注入dataSource 配置数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://127.0.0.1:3306/test"></property>
<property name="username" value="root"></property>
<property name="password" value="1234"></property>
<property name="initialSize" value="10"></property>
<property name="maxActive" value="50"></property>
<property name="maxIdle" value="30"></property>
<!-- 可以继续配置其他的属性 -->
</bean>
<!-- 配置sqlMapClient -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="configLocation" value="classpath:SqlMapConfig.xml"/>
</bean>
<!-- 配置具体的数据访问类 -->
<bean id="productDao" class="com.ccc.account.dao.impl.ProductDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
</property>
</bean>
<!-- 配置具体的业务逻辑类 -->
<bean id="productService" class="com.ccc.account.service.impl.ProductServiceImpl">
<property name="productDao">
<ref bean="productDao"/> <!-- ProductService productService=new ProductServiceImpl(); -->
</property>
</bean>
<!-- 配置Action -->
<bean id="productAction" class="com.ccc.account.action.ProductAction">
<property name="productService">
<ref bean="productService"/>
</property>
</bean>
<!-- 配置事务管理器 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 配置事务拦截器 -->
<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="txManager"/>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 配置事务传播 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" />
<tx:method name="find*" read-only="true" />
<tx:method name="search*" read-only="true" />
<tx:method name="query*" read-only="true" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 设置事务切面 -->
<aop:config>
<aop:pointcut id="serviceMethod" expression="execution(* com.ccc.account.service..*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod" />
</aop:config>
</beans>
没有合适的资源?快使用搜索试试~ 我知道了~
Spring各版本核心配置文件备份
共4个文件
xml:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 145 浏览量
2023-09-20
10:21:49
上传
评论
收藏 6KB ZIP 举报
温馨提示
java 技术分享:Spring各版本核心配置文件备份
资源推荐
资源详情
资源评论
收起资源包目录
Spring各版本核心配置文件备份.zip (4个子文件)
Spring各版本核心配置文件备份
applicationContext(V2.5).xml 4KB
applicationContext(V2.0).xml 3KB
applicationContext.xml 3KB
applicationContext(V3.0).xml 3KB
共 4 条
- 1
资源评论
小小哭包
- 粉丝: 1902
- 资源: 3901
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功