springmvc配置文件:spring-mybatis.xml
2017-11-18 00:02
429 查看
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://mybatis.org/schema/mybatis-spring
http://mybatis.org/schema/mybatis-spring.xsd">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:project-db.properties" />
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${driver}" />
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
<!-- 配置连接池的初始值 -->
<property name="initialSize" value="1" />
<!-- 连接池的最大值 -->
<!-- <property name="maxActive" value="500"/> -->
<!-- 最大空闲时,当经过一个高峰之后,连接池可以将一些用不到的连接释放,一直减少到maxIdle为止 -->
<!-- <property name="maxIdle" value="2"/> -->
<!-- 当最小空闲时,当连接少于minIdle时会自动去申请一些连接 -->
<property name="minIdle" value="1" />
<property name="maxActive" value="100" />
<property name="maxIdle" value="20" />
<property name="maxWait" value="1000" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 自动扫描mapping.xml文件 -->
<property name="mapperLocations" value="classpath:com/study/studymvc/mapper/*.xml"/>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.study.studymvc.dao" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://mybatis.org/schema/mybatis-spring
http://mybatis.org/schema/mybatis-spring.xsd">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:project-db.properties" />
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${driver}" />
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
<!-- 配置连接池的初始值 -->
<property name="initialSize" value="1" />
<!-- 连接池的最大值 -->
<!-- <property name="maxActive" value="500"/> -->
<!-- 最大空闲时,当经过一个高峰之后,连接池可以将一些用不到的连接释放,一直减少到maxIdle为止 -->
<!-- <property name="maxIdle" value="2"/> -->
<!-- 当最小空闲时,当连接少于minIdle时会自动去申请一些连接 -->
<property name="minIdle" value="1" />
<property name="maxActive" value="100" />
<property name="maxIdle" value="20" />
<property name="maxWait" value="1000" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 自动扫描mapping.xml文件 -->
<property name="mapperLocations" value="classpath:com/study/studymvc/mapper/*.xml"/>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.study.studymvc.dao" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
</beans>
相关文章推荐
- SSM(spring-springmvc-mybatis)整合开发xml配置文件内容springmvc-config.xml,application.xml,web.xml
- SSM:spring+springmvc+mybatis框架中的XML配置文件功能详细解释
- Mybatis与spring集成、Mybatis中xml配置文件标签含义
- 在Spring的配置文件applicationContext-mybatis.xml中配置数据源对象中,配置SQL心跳包及参数含义
- 简单的spring,springmvc,mybatis,maven,mysql,mongodb的一些配置文件,自己用的
- spring、springMVC、mybatis整合配置文件问题
- SSM:spring+springmvc+mybatis框架中的XML配置文件功能详细解释
- mybatis配置文件spring-mybatis.xml
- MyBatis Spring整合配置映射接口类与映射xml文件
- spring、springmvc、mybatis整合文件配置详解
- SpringMVC(1):基础配置文件web.xml 和 <servlet-name>-servlet.xml / springmvc.xml
- SpringMVC + mybatis 无法读取JAR包中的XML配置文件问题
- SqlMapConfig.xml --- 在spring配置文件中自动加载的mybatis文件
- 浅谈web.xml文件中加载Spring配置文件和SpringMVC配置文件
- Spring ,Springmvc,mybatis三大框架整合的配置文件支持
- 如何 在Spring MVC中 使用多个Spring和MyBatis的xml配置文件(多模块配置)
- springMVC配置文件spring-servlet.xml中<mvc:annotation-driven />的意义
- SSM:spring+springmvc+mybatis框架中的XML配置文件功能详细解释
- spring+springMVC+mybatis整合示例(基于XML配置文件)
- 【SpringMVC之配置文件(一)】spring 里面的ApplicationContext.xml 和 xxx-servlet.xml分别的作用是什么?