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. Url和Uri的区别

    URL: URL是Uniform Resoure Locator(统一资源定位器)的缩写.就是WWW页的地址. 其URL地址格式排列为:scheme://host:Port/path其中 ·Inter ...

  2. selenium自动化-java-封断言类2

    封装断言类 package streamax.com; import java.util.ArrayList; import java.util.List; import org.testng.Ass ...

  3. .net session_end

    在做asp.net编程开发的时候,我遇见这样的问题,一个用户只能在一台机器上登录, 如果有用户在其他机器上登录,系统将提示该用户已经登录!当前登陆非法!我的做法是: 用Application变量保存已 ...

  4. C#.NET 大型企业信息化系统 - 防黑客攻击 - SSO系统加固优化经验分享

    好久没写文章了,突然间也不知道写什么好了一样,好多人可能以为我死了,写个文章分享一下.证明一下自己还在,很好的活着吧,刷个存在感. 放弃了很多娱乐.休闲.旅游.写文章.看书.陪伴家人,静心默默的用了接 ...

  5. LeetCode Intersection of Two Arrays

    原题链接在这里:https://leetcode.com/problems/intersection-of-two-arrays/ 题目: Given two arrays, write a func ...

  6. MVC之前的那点事儿系列(10):MVC为什么不再需要注册通配符(*.*)了?

    文章内容 很多教程里都提到了,在部署MVC程序的时候要配置通配符映射(或者是*.mvc)到aspnet_ISPAI.dll上,在.NET4.0之前确实应该这么多,但是.NET4.0之后已经不要再费事了 ...

  7. ssh远程执行目标机器上的命令

    一句话: ssh -t -p 端口号 用户名@远程机器IP '远程机器上的命令完整路径' 例如: ssh -t -p 22 yangjunming@dev '/opt/app/deploy.sh' 注 ...

  8. mysql集群数据一致性校验

    目前,mysql在互联网行业使用地如火如荼,很多大型网站都在使用MySQL数据库,通过搭建mysql主备集群,实现高性能,高可用的存储方案.mysql集群的共同特性是通过复制来实现主备间的同步,保证主 ...

  9. 二维RMQ

    求二维ST表 ;k<=;k++) ;l<=;l++) ;i<=n;i++) ;j<=m;j++){ <<(l-)),m+),tx=min(n+,i+(<< ...

  10. 【jQuery】scroll 滚动到顶部

    Jquery 实现页面滚动到顶端 $(document).ready(function () { // 滚动窗口来判断按钮显示或隐藏 $(window).scroll(function () { // ...