分布式项目开发-spring-dao.xml基础配置
基础步骤:
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基础配置的更多相关文章
- pom.xml基础配置
pom.xml基础配置: maven中,最让我迷惑的还是那一堆配置! 就拿这个属性配置来说: 我需要让整个项目统一字符集编码,就需要设定 <project.build.sourceEncodin ...
- 初识quartz 并分析 项目中spring整合quartz的配置【原创+转载】
初识quartz 并分析 项目中spring整合quartz的配置[原创+转载]2018年01月29日 12:08:07 守望dfdfdf 阅读数:114 标签: quartz 更多个人分类: 工具 ...
- 使用github管理Eclipse分布式项目开发
使用github管理Eclipse分布式项目开发 老关我在前面的博文(github管理iOS分布式项目开发)中介绍了github管理iOS分布式开发,今天老关将向大家介绍使用github管 理Ecli ...
- Spring Boot微服务电商项目开发实战 --- 多环境部署配置、端口号统一配置及Dubbo提供者消费者实现
昨天已经搭建好了SpringBoot基于Maven的基础父子级项目,今天开始进入项目分模块及分布式实现.首先我们基于昨天的项目,在父级工程下建lyn-sys,lyn-customer,lyn-good ...
- spring web.xml 难点配置总结
web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...
- spring web.xml 难点配置总结【转】
web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...
- Java开发学习(三)----Bean基础配置及其作用范围
一.bean基础配置 对于bean的基础配置如下 <bean id="" class=""/> 其中,bean标签的功能.使用方式以及id和clas ...
- mybatis和spring的xml基本配置
mybatis 导入依赖环境 <dependency> <groupId>org.mybatis</groupId> <artifactId>mybat ...
- 分布式项目开发-web.xml基础配置
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http:// ...
随机推荐
- 虚拟化云计算平台Proxmox VE
1.虚拟化技术介绍 1.1.OpenVZ 简介 OpenVZ 是开源软件, 是基于Linux平台的操作系统级服务器虚拟化解决方案,它是基于Linux内核和作业系统的操作系统级虚拟化技术. OpenVZ ...
- GroupJoin()各参数的意义及用法
EF Core中GroupJoin的注释比较复杂: public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey ...
- PHP导出excel文件,第一步先实现PHP模板导出不带数据
今天继续研究PHP导出excel文件,把复杂的事情简单化,一步步实现功能,首先实现模板文件的导出,随后再实现写入数据后导出,最终实现功能,这是基本思路.中间可以加一步,先自己写入数据导出试试,随后再数 ...
- apply call bind的用法与实现
概念 apply call 和bind 允许为不同的对象分配和调用属于一个对象的函数/方法.同时它们可以改变函数内 this 的指向. 区别 apply 和 call 接收的参数形式不同 apply ...
- Mysql常用sql语句(17)- left/right join 外连接
测试必备的Mysql常用sql语句系列 https://www.cnblogs.com/poloyy/category/1683347.html 前言 外连接分为两种:left join.right ...
- mysql 中 innoDB 与 MySAM
mysql 中 innoDB 与 MyISAM 的特点 --ENGINE = innodb 1.提供事务处理,支持行锁: 2.不加锁读取,增加并发读的用户数量和空间: 3. insert/update ...
- sqli-labs之Page-1
搭建与安装 参考:https://www.fujieace.com/penetration-test/sqli-labs-ec.html 下载:sqli-labs下载 第一关:单引号报错注入 ?id= ...
- 工作总结1-----String.format的使用
以前在开发项目中,输入信息常使用的方法:"XXXXXXX"+a+"XXXXXXXXXXX"+b;,这种方式不仅不美观而且不易维护! String中的format ...
- influxes 基本概念
Influxes 基本概念 1.安装 两种,虚机的话直接下载二进制文件起就好了,容器也很方便,存储挂载到/var/lib/influxdb 起就ok,配置文件可以通过configmap挂载进去. 2. ...
- 「雕爷学编程」Arduino动手做(20)—水银开关模块
37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止37种的.鉴于本人手头积累了一些传感器和模块,依照实践出真知(一定要动手做)的理念,以学习和交流为目的,这里 ...