基础步骤:

1 数据源

2 sqlSessionFactory

3 MapperScan

打包。

db.properties文件

db.username=root
db.password=123456
db.url=jdbc:mysql://192.168.15.135:3310/user
db.driverClassName=com.mysql.jdbc.Driver  
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"> <!-- 数据源 -->
<bean id="dataSource"
class="com.alibaba.druid.pool.DruidDataSource">
<property name="username" value="${db.username}" />
<property name="password" value="${db.password}" />
<property name="url" value="${db.url}" />
<property name="driverClassName"
value="${db.driverClassName}" />
</bean> <!-- sqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- is org.apache.ibatis.builder.BuilderException 缺少约束头导致 -->
<property name="configLocation" value="classpath:mybatis.cfg.xml"/>
</bean> <!-- mapperScan -->
<bean id="mapperScan" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.sxt.mapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
</beans>

分布式项目开发-spring-dao.xml基础配置的更多相关文章

  1. pom.xml基础配置

    pom.xml基础配置: maven中,最让我迷惑的还是那一堆配置! 就拿这个属性配置来说: 我需要让整个项目统一字符集编码,就需要设定 <project.build.sourceEncodin ...

  2. 初识quartz 并分析 项目中spring整合quartz的配置【原创+转载】

    初识quartz 并分析 项目中spring整合quartz的配置[原创+转载]2018年01月29日 12:08:07 守望dfdfdf 阅读数:114 标签: quartz 更多个人分类: 工具 ...

  3. 使用github管理Eclipse分布式项目开发

    使用github管理Eclipse分布式项目开发 老关我在前面的博文(github管理iOS分布式项目开发)中介绍了github管理iOS分布式开发,今天老关将向大家介绍使用github管 理Ecli ...

  4. Spring Boot微服务电商项目开发实战 --- 多环境部署配置、端口号统一配置及Dubbo提供者消费者实现

    昨天已经搭建好了SpringBoot基于Maven的基础父子级项目,今天开始进入项目分模块及分布式实现.首先我们基于昨天的项目,在父级工程下建lyn-sys,lyn-customer,lyn-good ...

  5. spring web.xml 难点配置总结

    web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...

  6. spring web.xml 难点配置总结【转】

    web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...

  7. Java开发学习(三)----Bean基础配置及其作用范围

    一.bean基础配置 对于bean的基础配置如下 <bean id="" class=""/> 其中,bean标签的功能.使用方式以及id和clas ...

  8. mybatis和spring的xml基本配置

    mybatis 导入依赖环境 <dependency> <groupId>org.mybatis</groupId> <artifactId>mybat ...

  9. 分布式项目开发-web.xml基础配置

    <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http:// ...

随机推荐

  1. 重新认识Java注解

    重新认识Java注解 今天Debug看源码的时候,无意间看到这么个东西 首先承认我的无知,看到这个我很惊诧. 也勾起了我的好奇心,于是有了这篇认知记录. 下面就来重新认识下注解吧! 注解的本质 关于运 ...

  2. 跟哥一起学python(2)- 运行第一个python程序&环境搭建

    本节的任务,是完成我们的第一个python程序,并搭建好学习python的环境.  建议通过视频来学习本节内容: 查看本节视频 再次看看上一节提到的那张图,看看作为高级编程语言,我们如何编程. 首先, ...

  3. 使用Proteus模拟操作HDG12864F-1液晶屏

    在Proteus中模拟了89C52操作HDG12864F-1液晶屏,原理图如下: 一.HDG12864F-1官网信息 该液晶屏是Hantronix的产品,官网上搜索出这个型号是系列型号中的一种,各种型 ...

  4. 使用RSS订阅喜欢的微博博主

    获取uid方法:进入博主微博主页,使用控制台执行 /uid=(\d+)/. exec(document.querySelector('.opt_box .btn_bed').getAttribute( ...

  5. [hdu1085]生成函数

    题意:给a个1.b个2.c个5,求不能构成最小的数 思路: 先求1能构成的所有数,2能构成的所有数,5能构成的所有数,它们的方法数显然都是1,现在考虑把3者结合在一起,由于结果为和的形式,而又是循环加 ...

  6. search(13)- elastic4s-histograms:聚合直方图

    在聚合的分组统计中我们会面临两种分组元素类型:连续型如时间,自然数等.离散型如地点.产品等.离散型数据本身就代表不同的组别,但连续型数据则需要手工按等长间隔进行切分了.下面是一个按价钱段聚合的例子: ...

  7. PAT 1002 A+B for Polynomials (25分)

    题目 This time, you are supposed to find A+B where A and B are two polynomials. Input Specification: E ...

  8. 【Leetcode】164. Maximum Gap 【基数排序】

    Given an unsorted array, find the maximum difference between the successive elements in its sorted f ...

  9. 「雕爷学编程」Arduino动手做(39)——DS18B20温度传感器

    37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止37种的.鉴于本人手头积累了一些传感器和模块,依照实践出真知(一定要动手做)的理念,以学习和交流为目的,这里 ...

  10. wepy+vant-weapp踩坑记

    最近用了几个月的wepy框架,碰到了挺多问题,这里总结一下 1.clone的代码无法再本地运行,wepy报错 解决方案: 执行命令 : `npm install wepy-cli@1.6.1-alph ...