SSH - 基础篇 - applicationContext.xml
来源:互联网 发布:java web启动main方法 编辑:程序博客网 时间:2024/06/16 16:29
app<?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:aop="http://www.springframework.org/schema/aop"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
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">
<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
<!-- 配置session工厂 -->
<!--方式1:直接读取hibernate.cfg.xml -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
<!--添加声明式事务 -->
<!--定义一个事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--定义事务规则 -->
<aop:config>
<aop:pointcut id="mypoint" expression="execution(* cn.jbit.ssh.service..*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="mypoint"/>
</aop:config>
<!-- 事务增强 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true"/>
<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="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
<!-- Dept设置 -->
<!--dao 配置 -->
<!-- scope是作用域,默认的是singelton(单例模式),建议用prototype(每次请求时都创建一个新的bean)
request(每次请求创建一个新的实例,需要在webxml下配置监听),session和globalsession() -->
<bean id="deptDao" class="cn.jbit.ssh.dao.impl.DeptDaoImpl" scope="prototype">
<property name="sessionFactory" ref="sessionFactory" ></property>
</bean>
<!--service配置 -->
<bean id="deptService" class="cn.jbit.ssh.service.impl.DeptServiceImpl">
<property name="dao" ref="deptDao"></property>
</bean>
<!-- acion配置 -->
<bean id="deptAction" class="cn.jbit.ssh.action.DeptAction">
<property name="deptService" ref="deptService"></property>
</bean>
</beans>
<!-- ///////////////////////////////////////////////////////////////////////////////////// -->
<!-- 单词 -->
<!-- propagation[,prɒpə'ɡeɪʃən]传播;繁殖;增殖 -->
<!-- transaction[træn'zækʃ(ə)n; trɑːn-; -'sæk-]n. 交易;事务;办理;会报,学报 -->
<!-- scope[skəʊp]范围;余地;视野;眼界;导弹射程 -->
<!-- prototype['prəʊtətaɪp]原型;标准,模范 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
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">
<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
<!-- 配置session工厂 -->
<!--方式1:直接读取hibernate.cfg.xml -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
<!--添加声明式事务 -->
<!--定义一个事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--定义事务规则 -->
<aop:config>
<aop:pointcut id="mypoint" expression="execution(* cn.jbit.ssh.service..*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="mypoint"/>
</aop:config>
<!-- 事务增强 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true"/>
<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="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
<!-- Dept设置 -->
<!--dao 配置 -->
<!-- scope是作用域,默认的是singelton(单例模式),建议用prototype(每次请求时都创建一个新的bean)
request(每次请求创建一个新的实例,需要在webxml下配置监听),session和globalsession() -->
<bean id="deptDao" class="cn.jbit.ssh.dao.impl.DeptDaoImpl" scope="prototype">
<property name="sessionFactory" ref="sessionFactory" ></property>
</bean>
<!--service配置 -->
<bean id="deptService" class="cn.jbit.ssh.service.impl.DeptServiceImpl">
<property name="dao" ref="deptDao"></property>
</bean>
<!-- acion配置 -->
<bean id="deptAction" class="cn.jbit.ssh.action.DeptAction">
<property name="deptService" ref="deptService"></property>
</bean>
</beans>
<!-- ///////////////////////////////////////////////////////////////////////////////////// -->
<!-- 单词 -->
<!-- propagation[,prɒpə'ɡeɪʃən]传播;繁殖;增殖 -->
<!-- transaction[træn'zækʃ(ə)n; trɑːn-; -'sæk-]n. 交易;事务;办理;会报,学报 -->
<!-- scope[skəʊp]范围;余地;视野;眼界;导弹射程 -->
<!-- prototype['prəʊtətaɪp]原型;标准,模范 -->
0 0
- SSH - 基础篇 - applicationContext.xml
- ssh-applicationContext-commons.xml
- ssh--applicationContext.xml
- ssh项目applicationContext.xml出错
- SSH applicationContext.xml import异常
- SSH配置文件之applicationContext.xml
- SSH - 基础篇 - web.xml
- SSH-基础篇-struts.xml
- SSH框架中applicationContext.xml理解
- SSH框架applicationContext.xml简单配置
- SSH整合applicationContext.xml配置文件(my project)
- ssh web.xml beans.xml applicationContext.xml struts.xml
- SSH整合配置applicationContext.xml/hibernate.cfg.xml/struts.xml
- SSH中 applicationcontext.xml与web.xml的配置
- SSH-基础篇-hibernate.cfg.xml
- 搭建SSH框架的时候的applicationContext.xml配置文件
- SSH读取applicationContext.xml配置文件测试hibernate方法
- SSH框架的applicationContext.xml详解(非Annotation)
- 解析:Google开源的“Show and Tell”,是如何让机器“看图说话”的?
- Linux 2.6内核中新的锁机制--RCU
- 打开文件管理器读取录音文件报错问题解决方案
- Centos 7 安装后的必要设置 (将centos 7改造为LINUX桌面系统)
- 基于注解的输入校验
- SSH - 基础篇 - applicationContext.xml
- js动态处理select option
- 基于IE内核的一个WEB打印实现方案
- 硬盘(2T及2T以上)分区挂载
- 【SpringMVC架构】SpringMVC介绍(一)
- C#语法小知识(十三)带返回值的委托
- C++设计模式——代理模式
- Android中保存图片到本地功能实现 .
- 【ibatis】自定义mapper.xml文件(#与$的详解)