Spring的配置文件
来源:互联网 发布:和晟实业投资 知乎 编辑:程序博客网 时间:2024/06/08 19:14
<?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:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"><!-- Spring框架管理Service,mapper对象 --> <context:component-scan base-package="com.yue.ssm"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <!-- 加载外部属性资源文件 --> <context:property-placeholder location="classpath:/jdbc.properties"/> <!-- C3P0数据源 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${jdbc.driverClass}"/> <property name="jdbcUrl" value="${jdbc.jdbcUrl}"/> <property name="user" value="${jdbc.user}"/> <property name="password" value="${jdbc.password}"/> </bean> <!-- Spring要管理MyBatis框架的核心对象:SqlSessionFactory --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="configLocation" value="classpath:/mybatis-config.xml"/> <property name="typeAliasesPackage" value="com.yue.ssm.bean"/> <property name="mapperLocations"> <list> <value>classpath*:/config/mybatis/*Mapper.xml</value> </list> </property> </bean> <!-- 设置扫描Mapper接口及映射配置 --> <bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.yue.ssm.mapper"/> </bean> <!-- 事务管理器:切面类 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <!-- 声明式事务 --> <aop:config> <aop:pointcut expression="execution(public * com.yue.ssm.service.*Service.*(..))" id="txPointcut"/> <aop:advisor advice-ref="txAdviceId" pointcut-ref="txPointcut"/> </aop:config> <tx:advice id="txAdviceId" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" isolation="DEFAULT" rollback-for="java.lang.Exception" timeout="5"/> <tx:method name="update*" propagation="REQUIRED" isolation="DEFAULT" rollback-for="java.lang.Exception" timeout="5"/> <tx:method name="delete*" propagation="REQUIRED" isolation="DEFAULT" rollback-for="java.lang.Exception" timeout="5"/> <tx:method name="query*" read-only="true"/> <tx:method name="get*" read-only="true"/> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice></beans>
阅读全文
0 0
- spring的配置文件
- 详解Spring的配置文件
- 详解Spring的配置文件
- 详解Spring的配置文件
- 详解Spring的配置文件
- spring的XML配置文件
- Spring 配置文件的差异
- 详解Spring的配置文件
- 详解Spring的配置文件
- Spring的配置文件实例
- 详解Spring的配置文件
- Spring配置文件的测试
- spring的配置文件总结
- 标准的Spring配置文件
- 详解Spring的配置文件
- 详解Spring的配置文件
- Spring的配置文件详解
- 标准的spring配置文件
- html中linewidth示例
- 指数型组织:打造独角兽公司的11个最强属性
- j2ee-规范-jdbc四种驱动
- html中linecap示例
- html中lineJoin示例
- Spring的配置文件
- SpringMvc的配置文件
- mabatis 的映射文件mybatis-mapper.xml配置
- mybatis的逆向生成配置mybatis-generaction.xml
- mybatis的缓存配置--ehcache.xml(缓存配置文件)
- css选择器优先级及权重计算
- udev是什么? 它的目的何在?
- html中线性渐变
- 2017-05-27 IT杂谈,决断力读书笔记之找出与你持相反观点的人