context.xml配置文件

<?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:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> <context:component-scan base-package="com.jxyq" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
</context:component-scan> <bean id="springContextHolder" class="com.jxyq.config.SpringContextHolder"/> <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="fileEncoding" value="UTF-8"/>
<property name="locations">
<array>
<value>classpath:proxool.properties</value>
<value>classpath:security.properties</value>
<value>classpath:systemParam.properties</value>
</array>
</property>
</bean> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages"/>
</bean> <!--第一个数据源-->
<bean id="oneDataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource">
<property name="alias" value="${proxool.alias}"/>
<property name="driver" value="${proxool.driver}"/>
<property name="user" value="${proxool.user}"/>
<property name="password" value="${proxool.password}"/>
<property name="driverUrl" value="${proxool.url}"/>
<property name="trace" value="${proxool.trace}"/>
<property name="prototypeCount" value="${proxool.prototypeCount}"/>
<property name="maximumConnectionCount" value="${proxool.maximumConnectionCount}"/>
<property name="minimumConnectionCount" value="${proxool.minimumConnectionCount}"/>
<property name="simultaneousBuildThrottle" value="${proxool.simultaneousBuildThrottle}"/>
<property name="houseKeepingTestSql" value="${proxool.houseKeepingTestSql}"/>
</bean> <bean id="oneSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="oneDataSource"/>
<property name="configLocation" value="classpath:mybatis.xml"/>
<property name="mapperLocations">
<list>
<value>classpath:mapper/*.xml</value>
</list>
</property>
<property name="typeAliasesPackage" value="com.jxyq.model"/>
<property name="plugins">
<list>
<bean class="com.jxyq.commons.mybatis.pagination.PagingInterceptor">
<property name="dbModel" value="${proxool.dbModel}"/>
<property name="dialect">
<bean class="com.jxyq.commons.mybatis.pagination.dialect.OracleDialect"/>
</property>
<property name="sqlRegex" value=".*ByPage"/>
</bean>
</list>
</property>
</bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="oneDataSource"/>
</bean> <bean id="oneTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="oneDataSource"/>
</bean> <tx:annotation-driven transaction-manager="transactionManager"/> <bean id="oneTransactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
<property name="transactionManager" ref="oneTransactionManager"/>
</bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="oneSqlSessionFactory"></property>
<property name="basePackage" value="com.jxyq.mapper"/>
</bean> <bean id="oneResultMapManager" class="com.jxyq.config.ResultMapManager">
<property name="sqlSessionFactory" ref="oneSqlSessionFactory"/>
</bean> <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="3"/>
<property name="maxPoolSize" value="5"/>
<property name="queueCapacity" value="1000"/>
<property name="keepAliveSeconds" value="60"/>
<property name="rejectedExecutionHandler">
<bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy"/>
</property>
</bean> </beans>

proxool.properties配置文件

#SQLServer
proxool.alias=mainDB
proxool.dbModel=SQLServer
proxool.driver=net.sourceforge.jtds.jdbc.Driver
proxool.url=jdbc:jtds:sqlserver://193.160.17.251:1433;databasename=tempdb
proxool.user=sa
proxool.password=fnst1234
proxool.trace=true
proxool.prototypeCount=
proxool.maximumConnectionCount=
proxool.minimumConnectionCount=
proxool.simultaneousBuildThrottle=
proxool.houseKeepingTestSql=select current_date

驱动(mavem):

        <dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>

一开始时使用微软官方的驱动sqljdbc4(com.microsoft.sqlserver),但是一直报找不到合适的驱动,最后就改用jtds开源的驱动替代。

spring mvc+mybatis+sql server简单配置的更多相关文章

  1. spring+spring mvc+mybatis 实现主从数据库配置

    一.配置文件 1.jdbc.properties master_driverUrl=jdbc:mysql://localhost:3306/shiro?useUnicode=true&char ...

  2. MAVEN构建Spring +Spring mvc + Mybatis 项目(Maven配置部分(workshop))

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  3. SSM整合配置(Spring+Spring MVC+Mybatis)

    一.配置准备   通过Maven工程,在eclipse中整合SSM,并在Tomcat服务器上运行 在进行配置前,先理清楚要配置哪些文件,如图,除web.xml外,其余三个配置文件名称均可自定义: 如图 ...

  4. Spring+Spring MVC+MyBatis

    Spring+Spring MVC+MyBatis 目录 一.新建一个基于Maven的Web项目 二.创建数据库与表 三.添加依赖包 四.新建POJO实体层 五.新建MyBatis SQL映射层 六. ...

  5. ssm(spring mvc+mybatis)+netty4开发qiq

    发布时间:2018-10-30   技术:spring mvc+mybatis+nett4+layui   概述 简单快捷的IM方案,快速打造在线IM,可用于公司内网.外网通讯,客服系统等,实现了so ...

  6. java企业架构 spring mvc +mybatis + KafKa+Flume+Zookeeper

    声明:该框架面向企业,是大型互联网分布式企业架构,后期会介绍linux上部署高可用集群项目. 项目基础功能截图(自提供了最小部分)      平台简介        Jeesz是一个分布式的框架,提供 ...

  7. Spring MVC 学习总结(十)——Spring+Spring MVC+MyBatis框架集成(IntelliJ IDEA SSM集成)

    与SSH(Struts/Spring/Hibernate/)一样,Spring+SpringMVC+MyBatis也有一个简称SSM,Spring实现业务对象管理,Spring MVC负责请求的转发和 ...

  8. 基于Spring+Spring MVC+Mybatis的B2C购物网站

    代码地址如下:http://www.demodashi.com/demo/12935.html 准备工作 当前项目运行的系统环境是MacOS,已经测试可以正常运行,并且之前开发的时候也在Windows ...

  9. spring Mvc + Mybatis 中使用junit

    在Spring Mvc + Mybatis的项目中我们有时候需要在测试代码中注入Dao操作数据库,对表进行增删改查,实现如下: 这是一般的maven项目项目结构 测试代码一般写在src/test/ja ...

随机推荐

  1. [麦先生]TP3.2之微信开发那点事[基础篇](获取access_token)

    在微信文档中一共提供了两个access_token:一个是伪全局配置的Access_token;一个是在微信网页授权时的小Access_token 很多刚刚接触微信开发的人经常会混淆这两个的作用: 我 ...

  2. Ubuntu raid5+lvm实验

    首先说一下本次实验的环境:VMware12+Ubuntu (虚拟硬盘+mdadm) 本次实验参照http://allenyu.blog.51cto.com/193668/162067中的流程,下面总结 ...

  3. 总结javascript中的全局变量和局部变量的区别以及声明函数和调用函数的区别

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="utf-8&quo ...

  4. 安装node-sass提示没有vendor目录的解决办法

    在node-sass目录下面新建一个vendor的空目录,然后运行npm/cnpm rebuild node-sass --save-dev即可,如果安装失败,会生成一个目录名为类似这样win32-x ...

  5. 3942: [Usaco2015 Feb]Censoring [KMP]

    3942: [Usaco2015 Feb]Censoring Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 375  Solved: 206[Subm ...

  6. jquery easyui 1.4.1 API( CHM版)

    ChangeLog Bug The combogrid has different height than other combo components. fixed. datagrid: The r ...

  7. ubuntu14.04 python3.*连接mysql

    先下载pymysql文件,http://webscripts.softpedia.com/script/Database-Tools/PyMySQL-71606.html 我下载的是:PyMySQL- ...

  8. [转]struts2处理.do后缀的请求

    原文地址:http://skyuck.iteye.com/blog/545988 默认情况下,struts2是无法处理以.do为后缀的请求url的(默认情况下是.action或者不填,可以参见org. ...

  9. redis-介绍与比较

    <一>. NoSQL简介:    NoSQL是Not-Only-SQL的缩写,是被设计用来替换传统的关系型数据库在某些领域的用,特别针对web2.0站点以及大型的SNS网站,用来满足高并发 ...

  10. MySQL学习

    关于MySQL学习,先推荐一个网站,资源很多.讲得很细 StudyMySQL-最好的MySQL学习网站 我的MySQL学习之旅: 1.简单了解下MySQL数据库,安装MySQL.MySQL管理工具(刚 ...