applicationContext.xml配置Spring样板
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="tk.mybatis.*.service.impl"/>
<!--ibatis依赖mybatis-->
<bean id="dataSource" class="org.apache.ibatis.datasource.pooled.PooledDataSource">
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</bean> <!--sqlSession就是我们经常用来加载Mapper.xml,这里配置把sqlSessionFactory交给Spring容器生命周期管理-->
<!--需要注意的是
-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations">
<array>
<value>classpath:tk/mybatis/**/mapper/*.xml</value>
</array>
</property>
<property name="typeAliasesPackage" value="tk.mybatis.web.model"/>
</bean>
<!--自动扫描所有Mapper接口-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="tk.mybatis.**.mapper"/>
</bean>
</beans>
applicationContext.xml配置Spring样板的更多相关文章
- Spring,SpringMvc配置常见的坑,注解的使用注意事项,applicationContext.xml和spring.mvc.xml配置注意事项,spring中的事务失效,事务不回滚原因
1.Spring中的applicationContext.xml配置错误导致的异常 异常信息: org.apache.ibatis.binding.BindingException: Invalid ...
- Spring的配置文件ApplicationContext.xml配置头文件解析
Spring的配置文件ApplicationContext.xml配置头文件解析 原创 2016年12月16日 14:22:43 标签: spring配置文件 5446 spring中的applica ...
- springmvc.xml和applicationContext.xml配置的特点
1:springmvc.xml配置要点 一般它主要配置Controller的组件扫描器和视图解析器 下为:springmvc.xml文件 <?xml version="1.0" ...
- The difference between applicationContext.xml in Spring and xxx-servlet.xml in SpringMVC
一直搞不明白两者的区别.如果使用了SpringMVC,事实上,bean的配置完全可以在xxx-servlet.xml中进行配置.为什么需要applicationContext.xml?一定必须? 因为 ...
- spring的applicationContext.xml配置SessionFactory抛异常
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFa ...
- 关于Spring中applicationContext.xml配置错误“org/springframework/transaction/interceptor/TransactionInterceptor”的问题解决
问题描述: 在配置spring的applicationContext.xml中的默认事务管理器的时候可能会出现这样的错误: Error occured processing XML 'org/spri ...
- Spring学习总结(7)——applicationContext.xml 配置文详解
web.xml中classpath:和classpath*: 有什么区别? classpath:只会到你的class路径中查找找文件; classpath*:不仅包含class路径,还包括jar文件 ...
- 第九篇:Spring的applicationContext.xml配置总结
在前面的一篇日志中,记录了web.xml配置启动的顺序,web启动到监听器ContextLoaderListener时,开始加载spring的配置文件applicationContext.xml(通常 ...
- applicationContext.xml配置简介
这里简单介绍一下spring的配置文件applicationContext.xml中的一些配置的作用. <context:component-scan base-package="&q ...
随机推荐
- 关于一些没做出来的SBCF题
这里是一些我SB没做出来的CF水题. 其实这些题思维量还不错,所以写在这里常来看看…… 不一定每题代码都会写. CF1143C Queen 其实只要注意到如果一个点开始能被删,那一直就能被删:一个点开 ...
- navicat primium 快捷键与命令
1.ctrl+q 打开查询窗口 2.ctrl+/ 注释sql语句 3.ctrl+shift +/ 解除注释 4.ctrl+r 运行查询窗口的s ...
- 第三十节,目标检测算法之Fast R-CNN算法详解
Girshick, Ross. “Fast r-cnn.” Proceedings of the IEEE International Conference on Computer Vision. 2 ...
- opencv mat裁剪
主要记录的就是对Mat裁剪后,新Mat指向的内存和原来的Mat共用. OpenCV入门教程(3)-Mat类之选取图像局部区域
- Unity 着色过程
图形API包括:OpenGL.Metal.Vulkan.Director3D. 渲染管线(图形管线)通用结构: 1.数据收集(图形的网格.纹理.材质)--------2.顶点着色器(获取图形的2D坐标 ...
- Deepin或者Ubuntu上永久配件navicat
1.深度商店下载安装Navicat,期间可能会要求安装wine等. 2.安装完毕 终端环境下找到Navicat的安装目录 langzi@langzi-PC:~$ whereis ...
- python: 反射机制;
import comma def run(): inp = input('请输入要调用的函数').strip(); if hasattr(comma,inp): fun = getattr(comma ...
- maven_eclipse配置maven
1.eclipse配置3.3.9版本的maven 2.修改仓库位置
- ansible 基础一
安装 解决依赖关系: yum -y install python-jinja2 PyYAML python-paramiko python-babel python-crypto tar包安装 htt ...
- 面向对象【day07】:知识点回顾(十一)
本节内容 1.self关键字 2.封装 3.继承 4.静态方法 一.self关键字 作用:调用当前方法的对象 1 2 3 4 5 6 7 8 9 10 11 12 13 14 class Foo: ...