spring.xml
来源:互联网 发布:袜子属于淘宝哪个类目 编辑:程序博客网 时间:2024/05/22 02:08
<?xml version="1.0" encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"><!-- spring 是 bean的容器(service+repository) --><context:component-scan base-package="cn"><context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/></context:component-scan><!-- 所有数据库操作的源头 实现 自接口DataSourceDriverManagerDataSource(请求产生一个链接 用完关闭 尽量连接重用 连接池) --> <context:property-placeholder location="classpath:jdbc.properties"/> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"> <property name="url" value="${url}"></property> <property name="driverClassName" value="${driverClass}"></property> <property name="username" value="${username1}"></property> <property name="password" value="${password}"></property> <!-- 默认初始化的连接个数 --> <property name="initialSize" value="1"></property> <!-- 最大允许的链接个数 --> <property name="maxActive" value="200"></property> <!-- 最大的等待人数 --> <property name="maxIdle" value="100"></property> <!-- 开启sql统计功能 --> <property name="filters" value="stat"></property> </bean> <!-- 配置mybatis --> <!-- 配置session工厂 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> </bean> <bean id="sessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg index="0" ref="sqlSessionFactory"></constructor-arg> </bean> <!-- 扫描mybatis的接口映射 --> <bean id="scannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="cn.*..*.dao"></property> </bean> <!-- 配置管理器 --> <bean id = "tm" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <tx:advice id="txAdvise" transaction-manager="tm"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED"/> <tx:method name="update*" propagation="REQUIRED"/> <tx:method name="delete*" propagation="REQUIRED"/> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut expression="execution(* cn.*..*.service.*..*(..))" id="myPointCut"/> <!-- 关联切点和事务管理器 --> <aop:advisor advice-ref="txAdvise" pointcut-ref="myPointCut"/> </aop:config> </beans>
阅读全文
0 0
- Spring.xml
- spring.xml
- spring.xml
- spring xml
- spring xml
- spring-xml
- spring.xml
- Spring.xml
- spring.xml
- spring mybatis(spring-mybatis.xml)
- spring配置文件-spring-config.xml
- 配置pom.xml、spring.xml、spring-mvc.xml、spring-mybatis.xml、web.xml
- Spring XML配置技巧
- Spring XML配置技巧
- web.xml[spring][encoding]
- Spring bean.xml location
- spring的XML配置文件
- about spring applicationContext.xml
- access数据库远程连接
- 不通过注解,直接从request中读取POST请求体中数据
- 使用druid作为数据库连接池的配置文件写法
- linux日常问题
- 科林明伦杯哈尔滨理工大学第七届程序设计团队赛-水题*2
- spring.xml
- python 匿名函数 lambda
- CSS选择器的形式
- JVM--垃圾收集机制
- MAC下 安装MAMP的PHP7 redis扩展
- 在php中调用接口,传递数据
- jvm内存分析命令
- eclipse连接不上mysql Access denied for user 'root'@'localhost' (using password: YES)
- 杭电acm1789 Dong Homework again