Atitit.mybatis的测试  以及spring与mybatis在本项目中的集成配置说明

1.1. Mybatis invoke1

1.2. Spring的数据源配置2

1.3. Mybatis配置文件的位置2

1.1. Mybatis invoke

/AtiPlat_train/src/com/attilax/db/mybatisTO91.java

@SuppressWarnings("all")

public static void main(String[] args) throws IOException {

// TODO Auto-generated method stub

String resource = "com/attilax/db/ibatiascfg.xml";

Reader reader;

reader = Resources.getResourceAsReader(resource);

SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()

.build(reader);

SqlSession sqlSession = sqlSessionFactory.openSession();

List li=   sqlSession.selectList("getLockTables", 9999999);

//            StudentDao studentDao =sqlSession.getMapper(StudentDao.class);

//            Student st = studentDao.getstudent(1);

System.out.println( li.size());

List li2=    sqlSession.selectList("findRecords"," select 1 as tit ");

System.out.println(core.toJsonStrO88(li2));

}

1.2. Spring的数据源配置

D:\0workspace\AtiPlatf_train\src\applicationContext.xml

<context:property-placeholder location="classpath:jdbc.properties"/>

<!-- ati add q213 -->

<bean id="dataSource"

class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<property name="driverClassName" value="${ct.jdbc.driverClassName}" />

<property name="url" value="${ct.jdbc.url}" />

作者::  ★(attilax)>>>   绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

1.3. Mybatis配置文件的位置

<!-- 数据访问入口 -->

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" p:configLocation="classpath:/config/ibatis/sql-map-config.xml" p:dataSource-ref="dataSource"/>

Atitit.mybatis的测试  以及spring与mybatis在本项目中的集成配置说明的更多相关文章

  1. MyBatis学习七:spring和MyBatis整合

    <\mybatis\day02\16mybatis和spring整合-sqlSessionFactory配置.avi;> MyBatis学习七:spring和MyBatis整合.逆向工程 ...

  2. Spring整合MyBatis(二)Spring整合MyBatis

    摘要: 本文结合<Spring源码深度解析>来分析Spring 5.0.6版本的源代码.若有描述错误之处,欢迎指正. 了解了MyBatis的独立使用过程后,我们再看看它与Spring整合的 ...

  3. (原创)mybatis学习二,spring和mybatis的融合

    mybatis学习一夯实基础 上文介绍了mybatis的相关知识,这一节主要来介绍mybaits和spring的融合 一,环境搭建 1,jar包下载,下载路径为jar包 2,将包导入到java工程中 ...

  4. Mybatis(五)Spring整合Mybatis之mapper动态代理开发

    要操作的数据库: IDEA创建的Java工程,目录结构如下: 一.导包 1.spring的jar包 2.Mybatis的jar包 3.Spring+mybatis的整合包. 4.Mysql的数据库驱动 ...

  5. Spring JdbcTemplate详解及项目中的运用

    1.Spring对不同的持久化支持: Spring为各种支持的持久化技术,都提供了简单操作的模板和回调 ORM持久化技术 模板类 JDBC org.springframework.jdbc.core. ...

  6. 使用spring提供的ReflectionUtils简化项目中反射代码的复杂性

    在项目中有时候我们会使用到反射的功能,如果使用最原始的方法来开发反射的功能的话肯能会比较复杂,需要处理一大堆异常以及访问权限等问题.spring中提供了ReflectionUtils 这个反射的工具类 ...

  7. [转]SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)

    原文地址:http://blog.csdn.net/zhshulin/article/details/37956105#comments 使用SSM(Spring.SpringMVC和Mybatis) ...

  8. SSM框架——Spring+SpringMVC+Mybatis的搭建教程

    一:概述 SSM框架在项目开发中经常使用到,相比于SSH框架,它在仅几年的开发中运用的更加广泛. Spring作为一个轻量级的框架,有很多的拓展功能,最主要的我们一般项目使用的就是IOC和AOP. S ...

  9. idea集成spring+spring MVC+mybatis问题

    1.如果mybatis的xml文件放在java文件夹下(idea不会编译src的java目录的xml文件),需要在pom.xml中加入以下代码: <build> <resources ...

随机推荐

  1. HTML5的学习--performance

    HTML5提供的performance接口精确的告诉我们当访问一个网站页面时当前网页每个处理阶段的精确时间(timestamp),以方便我们进行前端分析. 它是浏览器的直接实现,比在网页中用js设置D ...

  2. Unity3d知识体系思维导图

    整理了一下U3D的技能树.

  3. Windows 下搭建 Ruby 开发环境

    1.从http://rubyinstaller.org/downloads/下载“rubyinstaller-2.1.5-x64.exe”. 2. 双击下载的程序进行安装,勾选如下图的选项.默认安装目 ...

  4. Windows Azure Web Site (10) Web Site测试环境

    <Windows Azure Platform 系列文章目录> 我们知道,在使用Azure Cloud Service的时候,会有2个不同的环境,称为Production环境和Stagin ...

  5. 谷歌插件Image downloader开发之 content script

    自己运营了一个公众号,在发文章的时候,需要在网上找一些图,而有些网站的图片可能隐藏在属性或者背景图中,要下载的时候经常审查元素,查看源码,不太方便,最近在看一些谷歌插件的api,便顺手做了一个插件Im ...

  6. Elasticsearch——禁止Body中的index覆盖Url中的index参数

    本篇继续一下Elasticsearch日常使用的技巧翻译. 在Elasticsearch有很多的api支持在body中指定_index等信息,比如mget或者msearch以及bulk. 默认的情况下 ...

  7. HT For Web 拓扑图背景设置

    HT For Web 的HTML5拓扑图组件graphView背景设置有多种途径可选择: divBackground:通过css设置graphView对应的div背景 Painter:通过graphV ...

  8. 图论 ---- spfa + 链式向前星 ---- poj 3268 : Silver Cow Party

    Silver Cow Party Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 12674   Accepted: 5651 ...

  9. java开源时间/日期库Joda-Time

    任何企业应用程序都需要处理时间问题.应用程序需要知道当前的时间点和下一个时间点,有时它们还必须计算这两个时间点之间的路径.使用 JDK 完成这项任务将非常痛苦和繁琐.现在来看看 Joda Time,一 ...

  10. Win10 QQ五笔默认中文,InputMode默认中文

    Win10系统安装了QQ五笔后,InputMode默认英文,必须用鼠标点或者按 Ctrl+空格才能转换为中文.非常不方便. 即使将微软拼音默认为中文也不管用,解决方法如下: 设置后,无论你打开运行.记 ...