Spring-MyBatis的配置文件
<?xml version="1.0" encoding="UTF8"?>
<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"> <!--DataSource:使用Spring的数据源替换Mybatis的配置 -->
<bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis?userSSL=true&userUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean> <!--sqlSessionFactory-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="datasource"/>
<!--绑定Mybatis配置文件-->
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<property name="mapperLocations" value="classpath:cn/lkx/mapper/UserMapper.xml"/>
</bean> <!--SqlSessionTemplate:我们使用的sqlSession-->
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<!--只能使用构造器注入sqlSessionFactory ,源码中没有set-->
<constructor-arg index="0" ref="sqlSessionFactory"/>
</bean> <bean id="userMapper" class="cn.lkx.mapper.impl.UserMapperImpl">
<property name="sqlSessionTemplate" ref="sqlSession"/>
</bean>
</beans>
Spring-MyBatis的配置文件的更多相关文章
- SpringMVC Spring MyBatis整合配置文件
		
1.spring管理SqlSessionFactory.mapper 1)在classpath下创建mybatis/sqlMapConfig.xml <?xml version="1. ...
 - SpringMVC+Spring+Mybatis -- 集成之旅
		
准备 首先介绍一下,我的工具使用的是STS, 需要的童鞋可以到官网下载:http://spring.io/tools/sts/all 使用STS是因为她集成了Maven进行 “包“ 管理以及自带 We ...
 - 搭建spring+mybatis+struts2环境的配置文件
		
1.web.xml配置 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=& ...
 - Spring mybatis源码篇章-sql mapper配置文件绑定mapper class类
		
前言:通过阅读源码对实现机制进行了解有利于陶冶情操,承接前文Spring mybatis源码篇章-MybatisDAO文件解析(二) 背景知识 MappedStatement是mybatis操作sql ...
 - spring和mybatis整合配置文件
		
查看所有springmvc spring mybatis配置文件见下链接: https://my.oschina.net/sherwayne/blog/262616 <?xml versio ...
 - Spring,SpringMVC,MyBatis,SSM配置文件比较
		
Spring配置文件: applicationContext.xml applicationContext.xml是Spring的核心配置文件 IOC/DI,AOP相关配置都是在这个文件中 Sprin ...
 - Idea SpringMVC+Spring+MyBatis+Maven调整【转】
		
Idea SpringMVC+Spring+MyBatis+Maven整合 创建项目 File-New Project 选中左侧的Maven,选中右侧上方的Create from archetyp ...
 - SpringMVC+Spring+MyBatis+Maven调整【转】
		
Idea SpringMVC+Spring+MyBatis+Maven整合 创建项目 File-New Project 选中左侧的Maven,选中右侧上方的Create from archetyp ...
 - Spring+Mybatis基于注解整合Redis
		
基于这段时间折腾redis遇到了各种问题,想着整理一下.本文主要介绍基于Spring+Mybatis以注解的形式整合Redis.废话少说,进入正题. 首先准备Redis,我下的是Windows版,下载 ...
 - Maven+Spring MVC Spring Mybatis配置
		
环境: Eclipse Neon JDK1.8.0 Tomcat8.0 先决条件: Eclipse先用maven向导创建web工程.参见本站之前随笔. 本机安装完成mysql5:新建用户xuxy03设 ...
 
随机推荐
- lua语言:string
			
转载请注明来源:https://www.cnblogs.com/hookjc/ 字符串库函数string.len(s) 返回字符串s的长度:string.rep(s, n) ...
 - Ansible playbook实现apache批量部署,并对不同主机提供以各自IP地址为内容的index.html
			
1.基于key验证免密授权 1.1 生成kekgen # ssh-keygen Generating public/private rsa key pair. Enter file in which ...
 - HTML笔记整理--下节
			
欢迎来到HTML基础笔记下节部分! 内联样式 当特殊的样式需要应用到个别元素时,就可以使用内联样式. 使用内联样式的方法是在相关的标签中使用样式属性.样式属性可以包含任何 CSS 属性.以下实例显示出 ...
 - 6、前端--DOM操作(查找标签、节点操作、获取值操作、class操作、样式操作、绑定事件、内置参数this)
			
DOM操作之查找标签 前缀关键字>>>:document # 基本查找(核心) document.getElementById 根据ID获取一个标签 document.getElem ...
 - 7、Linux基础--权限、查看用户信息
			
笔记 1.晨考 1.Linux系统中的文件"身份证号"是什么 index node 号码 2.什么是硬链接,什么是软连接 硬链接是文件的入口,软连接是快捷方式. 3.硬链接中保存的 ...
 - JVM调优——JVM监控工具jvisualvm的使用及GC插件安装
			
一.前言 在高并发的场景下,我们网站的的访问性能会降低,我们怎么优化,这是个问题!天天听JVM调优,实际上还是不知道怎么调优,调优也是看着网上说的修改一下JVM的堆的空间等等进行的.实际上我们应该在压 ...
 - Zookeeper应用之一:数据发布与订阅初体验
			
Zookeeper到底是什么?可以从Zookeeper提供的功能来理解.本篇小作文就是使用其提供的功能之一:数据发布与订阅. 需求:服务端开启多个实例提供服务,客户端使用服务.如果服务端某个服务下线或 ...
 - Dubbo基础之四管理控制台 dubbo-admin
			
Dubbo提供一个重要功能就是服务治理(SOA governance),什么是服务治理呢?企业为了确保项目顺利完成而实施的过程,需要进行各方面的管理.服务治理就是用来管理SOA的采用和实现的过程. 服 ...
 - python3发微信脚本
			
企业微信发微信脚本 #!/usr/bin/env python # -*- coding: utf-8 -*- #GuoYabin import requests,json,sys,imp imp.r ...
 - FSAF:嵌入anchor-free分支来指导acnhor-based算法训练 | CVPR2019
			
FSAF深入地分析FPN层在训练时的选择问题,以超简单的anchor-free分支形式嵌入原网络,几乎对速度没有影响,可更准确的选择最优的FPN层,带来不错的精度提升 来源:晓飞的算法工程笔记 公 ...