<?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/context
http://www.springframework.org/schema/context/spring-context.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">

<!--开启注解的扫描,希望处理service和dao,controller不需要Spring框架去处理-->
<context:component-scan base-package="com.ityw" >
<!--配置哪些注解不扫描-->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>

<!--Spring整合MyBatis框架-->
<!--配置连接池-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql:///ssm_ityw"/>
<property name="user" value="root"/>
<property name="password" value="root"/>
</bean>

<!--配置SqlSessionFactory工厂-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
</bean>

<!--配置AccountDao接口所在包-->
<bean id="mapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.ityw.dao"/>
</bean>

<!--配置Spring框架声明式事务管理-->
<!--配置事务管理器-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>

<!--配置事务通知-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true"/>
<tx:method name="*" isolation="DEFAULT"/>
</tx:attributes>
</tx:advice>

<!--配置AOP增强-->
<aop:config>
<aop:advisor advice-ref="txAdvice" pointcut="execution(* com.ityw.service.impl.*ServiceImpl.*(..))"/>
</aop:config>

</beans>

ssm整合之applicationContext.xml的更多相关文章

  1. SSH整合,applicationContext.xml中配置hibernate映射文件问题

    今天在applicationContext.xml中配置sessionFactory时遇到了各种头疼的问题,现在总结一下: 1.<property name="mappingDirec ...

  2. ssm框架中applicationContext.xml文件中配置别名

    在applicationContext.xml中配置如下: 通过以下property标签中给定name属性value属性及对应的值,来将domain包下所有实体类设置别名. 在xxxDao.xml中 ...

  3. ssm整合之web.xml文件

    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" " ...

  4. ssm整合的spring.xml文件配置(applicationContext.xml)

    <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...

  5. ssm整合(基于xml配置方式)

    本文是基于xml配置的方式来整合SpringMVC.Spring和Mybatis(基于注解的方式会再写一篇文章),步骤如下: (1)首先自然是依赖包的配置文件 pom.xml <project ...

  6. ssm整合的springmvc.xml的配置

    <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...

  7. SSM整合的pom.xml依赖

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  8. ssm整合之springmvc.xml文件

    <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...

  9. 零基础学习java------39---------json格式交互,Restful(不懂),静态资源映射,SSM整合(ssm整合思想,application.xml文件详解(声明式事务管理),)

    一. json格式交互(知道) 1 . 回顾ajax基本语法 $.ajax({ url:"", // 请求的后台路径 data:{"":"" ...

随机推荐

  1. spring boot之AOP

    首先,aop是面向对象切面,嗯,就是说不面向静态方法,我做测试demo的时候controller方法有个加了static,尴尬的是就用了那个方法测,检查了几遍配置... 参看这篇文章https://m ...

  2. 中间件、蓝图、g对象

    中间件 ''' flask中一旦请求到来,要执行app()--->>>执行的是app.__call__,整个flask的入口 ''' from flask import Flask ...

  3. 【Java并发编程】从CPU缓存模型到JMM来理解volatile关键字

    目录 并发编程三大特性 原子性 可见性 有序性 CPU缓存模型是什么 高速缓存为何出现? 缓存一致性问题 如何解决缓存不一致 JMM内存模型是什么 JMM的规定 Java对三大特性的保证 原子性 可见 ...

  4. 目标检测算法(一):R-CNN详解

    参考博文:https://blog.csdn.net/hjimce/article/details/50187029 R-CNN(Regions with CNN features)--2014年提出 ...

  5. 关于JAVA的垃圾回收机制

    使用JAVA编程时,几乎不需要考虑"内存泄漏"的问题,这也是JAVA相较于C++的一个优点. 最近在看<Java编程思想>(第四版,听说第五版有点牛逼....),里面讲 ...

  6. 基础篇:深入解析JAVA反射机制

    目录 反射的概念 获取Class的三种方法 JAVA反射API 反射机制应用的场景 反射和JDK动态代理 欢迎指正文中错误 关注公众号,一起交流 参考文章 反射的概念 java的放射机制:在程序运行时 ...

  7. Centos-rpm二进制包安装-rpm

    rpm 软件包管理器 rpm包命名规范 mysql-community-server-5.7.21-1.el7.x86_64.rpm 软件名称 mysql-community-server 软件版本 ...

  8. 在搞OSS对象存储中发现了自身的一些不足

    最近在搞OSS对象存储,发现了自身的一些不足,趁着有空在此做个总结,希望能够帮助到大家!!! 首先解释下OSS,Object Storage Service(对象存储服务),一般的云公司,都会提供OS ...

  9. LRU Cache & Bloom Filter

    Cache 缓存 1. 记忆 2. 空间有限 3. 钱包 - 储物柜 4. 类似背代码模板,O(n) 变 O(1)     LRU Cache 缓存替换算法 1. Least Recently Use ...

  10. 实验 2:Mininet 实验——拓扑的命令脚本生成

    一.实验目的 掌握 Mininet 的自定义拓扑生成方法:命令行创建.Python 脚本编写 二.实验任务 通过使用命令行创建.Python 脚本编写生成拓扑,熟悉 Mininet 的基本功能. 三. ...