applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"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-3.1.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd" default-autowire="byName"><!-- 配置数据源 --><bean id="config" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><property name="locations"><list><value>classpath:jdbc.properties</value></list></property></bean><!-- dataSource --><bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"><property name="url" value="${jdbc.url}"></property><property name="driverClassName" value="${jdbc.driver}"></property><property name="username" value="${jdbc.username}"></property><property name="password" value="${jdbc.password}"></property></bean><!-- sessionFaction --><bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource" ref="dataSource"></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop><prop key="hibernate.show_sql">true</prop><prop key="hibernate.format_sql">true</prop></props></property><property name="mappingDirectoryLocations"><list><value>classpath:org/entity</value></list></property></bean><!-- 事务 --><bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory"></property></bean><!-- 增强 --><tx:advice id="txAdvice" transaction-manager="txManager"><tx:attributes><tx:method name="add*" propagation="REQUIRED"/><tx:method name="save*" propagation="REQUIRED"/><tx:method name="update*" propagation="REQUIRED"/><tx:method name="del*" propagation="REQUIRED"/><tx:method name="get*" read-only="true"/><tx:method name="find*" read-only="true"/><tx:method name="query*" read-only="true"/><tx:method name="*"/></tx:attributes></tx:advice><aop:config><aop:pointcut id="mycut" expression="execution(* org.service..*.*(..))" /><aop:advisor advice-ref="txAdvice" pointcut-ref="mycut"/></aop:config> <!-- 引入dao层 --><import resource="applicationContext-dao.xml"/><!-- 引入service层 --><import resource="applicationContext-service.xml"/><!-- 引入action层 --><import resource="applicationContext-action.xml"/></beans>

applicationContext-action.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"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-3.1.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd" default-autowire="byName"><bean id="deptAction" class="org.web.DeptAction"></bean></beans>

applicationContext-dao.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" default-autowire="byName"><!-- 配置DAO --><bean id="deptDao" class="org.dao.impl.DeptDaoImpl"><property name="sessionFactory" ref="sessionFactory"></property></bean></beans>

applicationContext-service.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"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-3.1.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd" default-autowire="byName"><bean id="deptService" class="org.service.impl.DeptServiceImpl"></bean></beans>

最全三大框架整合(使用映射)——applicationContext.xml里面的配置相关推荐

  1. 最全三大框架整合(使用映射)——struts.xml和web.xml配置

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "- ...

  2. 最全三大框架整合(使用映射)——数据库资源文件jdbc.properties

    jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl jdbc.driver=oracle.jdbc.OracleDriver jdbc.username=pr ...

  3. 最全三大框架整合(使用映射)——DeptAction.java

    /** * @Title: DeptAction.java * @Package org.web * @Description: TODO该方法的主要作用: * @author A18ccms A18 ...

  4. 最全三大框架整合(使用映射)——DeptServiceImpl.java

    /** * @Title: DeptServiceImpl.java * @Package org.service.impl * @Description: TODO该方法的主要作用: * @auth ...

  5. 最全三大框架整合(使用映射)——IDeptService.java

    /** * @Title: DeptDaoImpl.java * @Package org.dao.impl * @Description: TODO该方法的主要作用: * @author A18cc ...

  6. 最全三大框架整合(使用映射)——DeptDaoImpl.java

    /** * @Title: DeptDaoImpl.java * @Package org.dao.impl * @Description: TODO该方法的主要作用: * @author A18cc ...

  7. 最全三大框架整合(使用映射)——IDeptDao.java

    /** * @Title: IDeptDao.java * @Package org.dao * @Description: TODO该方法的主要作用: * @author A18ccms A18cc ...

  8. 最全三大框架整合(使用映射)——Dept.hbm.xml

    <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBL ...

  9. 最全三大框架整合(使用映射)——Emp.hbm.xml

    <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBL ...

最新文章

  1. 【Qt】Qt Creator中文输入设置
  2. UIWindow简单介绍
  3. 百度云android隐藏空间,一招教你使手机端百度网盘中的隐藏空间在文件列表中显示出来...
  4. CPU所含有的寄存器
  5. linux as3.0 sendmail SMTP 验证 成功总结
  6. get clone 出现 fatal: the remote end hung up unexpectedly5 MiB | 892.00 KiB/s 报错信息
  7. 【Liunx】manjaro 配置vscode python开发环境
  8. mybatis源码学习篇之——执行流程分析
  9. 科研|青椒工作九年后感慨:比SCI重要,比项目值钱的是…
  10. python菜鸟教程网-Python JSON
  11. 区块链100讲:详解Po.et 技术栈
  12. linux下实用小脚本,linux下shell常用脚本大集合啦
  13. 帆软连接kingbase8
  14. 网页内容变化实时监控提醒(多个复杂的监控条件)
  15. matlab数字信号处理常用函数
  16. Python编程:通过百度文字识别提取表格数据
  17. 小程序 获取今天日期 星期几 不墨迹就是快
  18. python实现qq登录腾讯视频_QQ腾讯视频爬取和qv_rmt限速算法python版
  19. CSDN的收藏夹在哪里管理
  20. 系分 - 操作系统 - 嵌入式

热门文章

  1. 数据结构----单源最短路径Dijkstra
  2. Mac(OS X)安装、配置并使用MySQL数据库
  3. cannot find #include caffe/proto/caffe.pb.h
  4. Eltwise_layer简介
  5. 最优间隔分类器-SVM
  6. Codeforces Round #590 (Div. 3) E. Special Permutations 差分 + 思维
  7. 线段树——思维(Codeforces 339D Xenia and Bit Operations/Billboard HDU - 2795)
  8. 牛客题霸 [有关阶乘的两个问题1] C++题解/答案
  9. 排列组合十一个性质公式及证明,错排数公式及证明
  10. 理解至上:二叉堆与优先队列详细用法