zoukankan      html  css  js  c++  java
  • 注解方式spring4.3.1+struts2 2.3.1+hibernate4.1.2中applicationContext.xml配置文件

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:cache="http://www.springframework.org/schema/cache" xmlns:p="http://www.springframework.org/schema/p"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
         http://www.springframework.org/schema/aop
         http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context-3.0.xsd
         http://www.springframework.org/schema/tx
         http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
          http://www.springframework.org/schema/mvc
          http://www.springframework.org/schema/mvc/spring-mvc-.xsd
         http://www.springframework.org/schema/cache
         http://www.springframework.org/schema/cache/spring-cache-3.0.xsd">
        <context:annotation-config />
        <context:component-scan base-package="com.*" />
    
        <!--代替hibernate.cfg.xml书写配置文件 -->
    <!--     <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"> -->
    <!--         <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> -->
    <!--         <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" /> -->
    <!--         <property name="username" value="shao" /> -->
    <!--         <property name="password" value="a123" /> -->
    <!--     </bean> -->
        <!--加载sessionFactory -->
    <!--     <bean id="sessionFactory" -->
    <!--         class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> -->
    <!--         <property name="dataSource" ref="dataSource" /> -->
    <!--         <property name="mappingResources"> -->
    <!--             <list> -->
    <!--                 <value>cfg/Mailtb.hbm.xml</value> -->
    <!--                 <value>cfg/Orderitem.hbm.xml</value> -->
    <!--                 <value>cfg/Orders.hbm.xml</value> -->
    <!--                 <value>cfg/Product.hbm.xml</value> -->
    <!--                 <value>cfg/Productuser.hbm.xml</value> -->
    <!--                 <value>cfg/User_product.hbm.xml</value> -->
    <!--             </list> -->
    <!--         </property> -->
            <!--配置属性文件即在*.properties文件中的属性 -->
    <!--         <property name="hibernateProperties"> -->
    <!--             <props> -->
    <!--                 <prop key="show_sql">true</prop> -->
    <!--                 <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> -->
    <!--             </props> -->
    <!--         </property> -->
    <!--     </bean> -->
    
        <!--AOP 切面开启事务,同时也是为了解决注解方式继承HibernateDaoSupport之后无法更新数据问题 -->
        <!--AOP Start(记住要导入aspectj.jar包不然会报错) -->
        <!-- 定义事务管理器(声明式的事务) -->
    <!--     <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="*" propagation="REQUIRED" /> -->
    <!--         </tx:attributes> -->
    <!--     </tx:advice> -->
        <!--事务的含盖范围,最后要.*.*结尾,拦截该包下的所有方法 -->
    <!--     <aop:config> -->
    <!--         <aop:pointcut id="interceptorPointCuts" -->
    <!--             expression="execution(* com.newtouch.service.*.*(..))" /> -->
    <!--         <aop:advisor advice-ref="txAdvice" pointcut-ref="interceptorPointCuts" /> -->
    <!--     </aop:config> -->
        <!--AOP end -->
    </beans>
  • 相关阅读:
    Jmeter+Ant+Jenkins搭建持续集成的接口测试(推荐 Mark)
    配置sonar、jenkins进行持续审查
    查看端口占用
    CentOS 6.5系统上安装SVN服务器端的方法及目录访问权限配置(转总结)
    Windows批处理 调用程序后 不等待子进程 父进程继续执行命令
    Jmeter笔记:响应断言详解
    Ubuntu 16.04常用快捷键
    如何永久激活(破解) IntelliJ IDEA 2018.2
    Cobbler自动化部署
    Typora使用说明(记录总结)
  • 原文地址:https://www.cnblogs.com/ShaoXin/p/7383805.html
Copyright © 2011-2022 走看看