<?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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<!--读取配置文件 -->
<bean class=" org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:datasource.properties"></property>
</bean>
<!-- 配置数据源-->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</bean>
<!--配置mybatis里的sessionFactroy -->
<bean id="sessionFactory" class=" org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
</bean>

<!--映射接口扫描mapper包下的所有xml文件 mapper是个包名 应该是在main测试的时候才使用--->

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.liu.mapper"></property>
</bean>

<!--配置声明试事务 配置事务管理器 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!--配置事务通知 -->
<tx:advice id="txadvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!--配置切面 必须要有空格 *空格 ssmy 否则会报错--> 
<aop:config>
<aop:pointcut expression="execcution(*空格 ssmy.service.impl.*.*(..))" id="pointcut"/>
<aop:advisor advice-ref="txadvice" pointcut-ref="pointcut"/>
</aop:config>
<context:component-scan base-package="ssmy"/>
</beans>

spring +springmvc+mybatis组合applicationContext.xml文件配置的更多相关文章

  1. spring +springmvc+mybatis组合mybatis-config.xml文件配置

    <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE configurationPUBLIC &q ...

  2. spring +springmvc+mybatis组合web.xml文件配置

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

  3. Spring配置文件详解 – applicationContext.xml文件路径

    Spring配置文件详解 – applicationContext.xml文件路径 Java编程                 spring的配置文件applicationContext.xml的默 ...

  4. Spring框架入门之基于xml文件配置bean详解

    关于Spring中基于xml文件配置bean的详细总结(spring 4.1.0) 一.Spring中的依赖注入方式介绍 依赖注入有三种方式 属性注入 构造方法注入 工厂方法注入(很少使用,不推荐,本 ...

  5. Spring中加载ApplicationContext.xml文件的方式

    Spring中加载ApplicationContext.xml文件的方式 原文:http://blog.csdn.net/snowjlz/article/details/8158560 1.利用Cla ...

  6. Spring+springmvc+Mybatis整合案例 xml配置版(myeclipse)详细版

    Spring+springmvc+Mybatis整合案例 Version:xml版(myeclipse) 文档结构图: 从底层开始做起: 01.配置web.xml文件 <?xml version ...

  7. IntelliJ IDEA 14.0.3 实战搭建Spring+SpringMVC+MyBatis组合框架

    简介 Spring+SpringMVC+MyBatis框架(SSM)是比较热门的中小型企业级项目开发的框架,对于新手来说也是比较容易学习入门的.虽说容易,但在框架搭建过程中仍然遇到了许多问题,因此用实 ...

  8. Spring配置文件详解 - applicationContext.xml文件路径

    spring的配置文件applicationContext.xml的默认地址在WEB-INF下,只要在web.xml中加入代码 org.springframework.web.context.Cont ...

  9. spring +springmvc+mybatis组合总结

    springmvc+spring+mybatis整合:1. 拷贝所需jar2. 创建spring配置文件(beans.xml)3. 配置数据源 <bean id="dataSource ...

随机推荐

  1. /usr/bin/python^M: 解释器错误: 没有那个文件或目录

    遇见问题 因为linux在虚拟机中,所以就在本地敲python代码,敲完后再拿到虚拟机去执行,再输入./filename.py时,就遇到这样的一个问题: bash: ./filename.py: /u ...

  2. 11154 LRC才不会告诉你们的事情

    #include<stdio.h> #include<string.h> int main() { ,t=; ],sum[],k=,d=; ]; ]; scanf(" ...

  3. PHP开发微信模版消息换行的问题

    微信是个坑!微信是个坑!微信是个坑!重要的时间说三遍 关键的地方是空白换行符到底是什么也不说,百度说是"\n":但是在发送消息的时候发现原样输出,发现json_encode对\n进 ...

  4. Grid search in the tidyverse

    @drsimonj here to share a tidyverse method of grid search for optimizing a model's hyperparameters. ...

  5. python_day5--->递归函数,二分法查找

    li = [1, 5, 6, 7, 12, 22, 33, 44, 55, 66, 77, 88, 99, 111, 222, 333]def er(num,li): if len(li) ==0: ...

  6. QUICK-AP + BETTERCAP 替换局域网内其他用户的下载文件为自定义文件

    环境需求 :kali系统 , .0版本 :quick-ap :bettercap :bettercap-proxy-modules :...... 主要环境搭建 目的:替换局域网用户的下载文件,变为我 ...

  7. Ubuntu环境下 matplotlib 图例中文乱码

    最近做了一个最小二乘法的代码编写并用 matplotlib 绘制了一张图,但是碰到了中文乱码问题.简单搜索之后,发现有人总结出了比较好的方案,亲测可行.推荐给大家. 本文前提条件是 已经 安装好 ma ...

  8. Web前端性能优化全攻略

    网页制作poluoluo文章简介:Web 前端性能优化是个大话题,是个值得运维人员持续跟踪的话题,是被很多网站无情忽视的技术. Web 前端性能优化是个大话题,是个值得运维人员持续跟踪的话题,是被很多 ...

  9. JavaWeb系列:Servlet

    个人整理,欢迎转载与批评建议,转载请添加索引,谢谢. ---------------------------------------------------------------2017.06.10 ...

  10. JS 点击复制按钮 将文字复制到手机剪贴板

    我们在制作移动端网页的时候,经常会遇到这样一个问题,如何点击一个"复制"按钮,把一串文字复制到手机剪贴板,如上图所示. 看了网上的一些方法后,感觉那些方法都太复杂,有点要用插件,有 ...