spring mvc+mybatis+sql server简单配置
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简单配置的更多相关文章
- spring+spring mvc+mybatis 实现主从数据库配置
一.配置文件 1.jdbc.properties master_driverUrl=jdbc:mysql://localhost:3306/shiro?useUnicode=true&char ...
- MAVEN构建Spring +Spring mvc + Mybatis 项目(Maven配置部分(workshop))
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- SSM整合配置(Spring+Spring MVC+Mybatis)
一.配置准备 通过Maven工程,在eclipse中整合SSM,并在Tomcat服务器上运行 在进行配置前,先理清楚要配置哪些文件,如图,除web.xml外,其余三个配置文件名称均可自定义: 如图 ...
- Spring+Spring MVC+MyBatis
Spring+Spring MVC+MyBatis 目录 一.新建一个基于Maven的Web项目 二.创建数据库与表 三.添加依赖包 四.新建POJO实体层 五.新建MyBatis SQL映射层 六. ...
- ssm(spring mvc+mybatis)+netty4开发qiq
发布时间:2018-10-30 技术:spring mvc+mybatis+nett4+layui 概述 简单快捷的IM方案,快速打造在线IM,可用于公司内网.外网通讯,客服系统等,实现了so ...
- java企业架构 spring mvc +mybatis + KafKa+Flume+Zookeeper
声明:该框架面向企业,是大型互联网分布式企业架构,后期会介绍linux上部署高可用集群项目. 项目基础功能截图(自提供了最小部分) 平台简介 Jeesz是一个分布式的框架,提供 ...
- Spring MVC 学习总结(十)——Spring+Spring MVC+MyBatis框架集成(IntelliJ IDEA SSM集成)
与SSH(Struts/Spring/Hibernate/)一样,Spring+SpringMVC+MyBatis也有一个简称SSM,Spring实现业务对象管理,Spring MVC负责请求的转发和 ...
- 基于Spring+Spring MVC+Mybatis的B2C购物网站
代码地址如下:http://www.demodashi.com/demo/12935.html 准备工作 当前项目运行的系统环境是MacOS,已经测试可以正常运行,并且之前开发的时候也在Windows ...
- spring Mvc + Mybatis 中使用junit
在Spring Mvc + Mybatis的项目中我们有时候需要在测试代码中注入Dao操作数据库,对表进行增删改查,实现如下: 这是一般的maven项目项目结构 测试代码一般写在src/test/ja ...
随机推荐
- python学习笔记-python程序运行
小白初学python,写下自己的一些想法.大神请忽略. 安装python编辑器,并配置环境(见http://www.cnblogs.com/lynn-li/p/5885001.html中 python ...
- JS -- 异步加载进度条
今天在博客园问答里面看到博友问道怎么实现Ajax异步加载产生进度条. 很好奇就自己写了一个. 展现效果: 1) 当点击Load的时候,模拟执行异步加载. 浏览器被遮挡. 进度条出现. 实现思路: 1. ...
- 线程同步以及 yield() wait()和notify()、notifyAll()
1.yield() 该方法与sleep()类似,只是不能由用户指定暂停多长时间,并且yield()方法只能让同优先级的线程有执行的机会. 2.wait()和notify().notifyAll() 这 ...
- linux tcp超时重传实现分析
kernel version 3.18.20 1.函数调用关系 tcp_ack-> tcp_clean_rtx_queue-> tcp_ack_update_rtt-> tp-> ...
- Linux常用命令(二)
2.2.其他权限管理命令 命令名称:chown 功能:更改文件目录或文件的所有者语法:chown[用户][文件或目录]命令名称:chgrp 功能:改变文件或目录的所属组语法:chgrp[用户][文件或 ...
- ORA-04091: table is mutating, trigger/function may not see it
今天在论坛里发现了一个关于ORA-04091的老帖子,收获良多,特此整理一下 关于ORA-04091: table is mutating, trigger/function may not see ...
- jQuery基础课程
环境搭建 搭建一个jQuery的开发环境非常方便,可以通过下列几个步骤进行. 下载jQuery文件库 在jQuery的官方网站(http://jquery.com)中,下载最新版本的jQuery文件库 ...
- JS组件系列——Bootstrap寒冬暖身篇:弹出框和提示框效果以及代码展示
前言:对于Web开发人员,弹出框和提示框的使用肯定不会陌生,比如常见的表格新增和编辑功能,一般常见的主要有两种处理方式:行内编辑和弹出框编辑.在增加用户体验方面,弹出框和提示框起着重要的作用,如果你的 ...
- C 语言学习的第 05 课:C 语言基础(01)
C语言程序中的绝大部分应该记录在以.c作为扩展名的文件里,这种文件叫做C语言 程序的源文件. C语言中还包括以.h作为扩展名的文件,这种文件叫做头文件. C语言中的四则运算: 加:+ 减:- 乘 ...
- github-windows本地安装
Step1 准备工作 msysgit,下载地址为 http://msysgit.github.io/ . Eclipse IDE for Java EE Developers(必须是这个,自带Egit ...