springAOP配置文件
<?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:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
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-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/ssh2</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>123456</value>
</property>
</bean>
<!-- 配置sessionFactory -->
<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.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/zhanghaobo/bean/User.hbm.xml</value>
</list>
</property>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 哪些类哪些方法使用事务 -->
<aop:config>
<!-- 定义在哪些方法上开启事务-->
<aop:pointcut expression="execution(* com.zhanghaobo.service.impl.*.*(..))" id="allManagerMethod"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
<aop:aspect id="authorAspect" ref="authorityInterceptor">
<aop:before method="checkAuthor" pointcut-ref="allManagerMethod"/>
</aop:aspect>
</aop:config>
<!-- 事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<bean id="authorityInterceptor" class="com.zhanghaobo.interceptor.AuthorityInterceptor">
<property name="user">
<value>aaa</value>
</property>
</bean>
<bean id="userService" class="org.springframework.aop.framework.ProxyFactoryBean" >
<property name="target" ref="userServiceTarget"></property>
<property name="proxyInterfaces">
<value>com.zhanghaobo.service.UserService</value>
</property> <property name="interceptorNames">
<value>authorityInterceptor</value>
</property>
</bean>
<bean id="userDao" class="com.zhanghaobo.dao.impl.UserDAOImpl" scope="singleton">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="userServiceTarget" class="com.zhanghaobo.service.impl.UserServiceImpl" scope="singleton">
<property name="userdao" ref="userDao"></property>
</bean>
<bean id="saveUserAction" class="com.zhanghaobo.action.user.SaveUserAction" scope="prototype">
<property name="userService" ref="userService"></property>
</bean>
<bean id="listUserAction" class="com.zhanghaobo.action.user.listUser" >
<property name="userService" ref="userService"></property>
</bean>
</beans>
springAOP配置文件的更多相关文章
- Spring的jdbcTemplate 与原始jdbc 整合c3p0的DBUtils 及Hibernate 对比 Spring配置文件生成约束的菜单方法
以User为操作对象 package com.swift.jdbc; public class User { private Long user_id; private String user_cod ...
- 转-springAOP基于XML配置文件方式
springAOP基于XML配置文件方式 时间 2014-03-28 20:11:12 CSDN博客 原文 http://blog.csdn.net/yantingmei/article/deta ...
- 7.spring:SpringAOP(配置文件)
SpringAOP(xml文件配置) 配置文件的方式,主要是在xml文件中进行配置,不使用注解! 目录: AtithmeticCalculator.java public interface Atit ...
- spring-AOP框架(基于配置文件的方式配置AOP)
.xml: ref-指向,order-指定优先级
- Spring配置文件标签报错:The prefix "XXX" for element "XXX:XXX" is not bound. .
例如:The prefix "context" for element "context:annotation-config" is not bound. 这种 ...
- 使用maven给spring项目打可直接运行的jar包(配置文件内置外置的打法)
从网上看过许多打jar包的例子,大多是将配置文件打进jar包的.经过本人一番研究,终于搞清楚了怎样将jar包的配置文件外置. 废话不说,直接上spring的pom.xml的配置文件. <proj ...
- Spring MVC的配置文件(XML)的几个经典案列
1.既然是配置文件版的,那配置文件自然是必不可少,且应该会很复杂,那我们就以一个一个的来慢慢分析这些个经典案列吧! 01.实现Controller /* * 控制器 */ public class M ...
- Spring-AOP实践 - 统计访问时间
公司的项目有的页面超级慢,20s以上,不知道用户会不会疯掉,于是老大说这个页面要性能优化.于是,首先就要搞清楚究竟是哪一步耗时太多. 我采用spring aop来统计各个阶段的用时,其中计时器工具为S ...
- SpringAOP详解(转载大神的)
AOP(Aspect-Oriented Programming)这个东西,名字与 OOP 仅差一个字母,其实它是对 OOP 编程方式的一种补充,并非是取而代之.翻译过来就是"面向方面编程&q ...
随机推荐
- wdcp v3 Forbidden :You don't have permission to access /phpmyadmin on this server
First edit the file /www/wdlinux/apache/conf/vhost/00000.default.conf and add the additional line to ...
- Android程序架构基本内容概述
在Android操作系统中开发的应用程序都有一个结构缜密的架构.我们今天就来对这一Android程序架构做一个详细的分析.帮助大家了解程序开发的特点,以方便将来在应用程序开中明确自己的程序架构. An ...
- VB6 仿.netWinfrom控件 Anchor属性类
vb6中控件没有anchor与dock属性,窗体变大后原来要在resize中调整控件的move属性,否则就面目全非了.网上找到一些调整控件大小的代码,发现并不太适合自己,于是按照思路自己做了一个类似a ...
- 20160126.CCPP体系详解(0005天)
程序片段(01):eatmem.c 内容概要:语句和逻辑结构 #include <stdio.h> #include <stdlib.h> #include <Windo ...
- Myeclipse 安装Aptana3.2 插件
转自(http://www.cnblogs.com/yinger/archive/2011/08/29/2157193.html) 安装步骤: 1.下载aptana3.2 Eclipse Plugin ...
- uva 11991
STL 使用,,由于数据范围没有 超越极限数据 依旧可以用 vector 搞定: #include<iostream> #include<stdio.h> #include& ...
- 【转】让Souce Insight支持多种语言的语法高亮:Python,Ruby,ARM汇编,windows脚本文件(bat/batch),PPC,SQL,TCL,Delphi等
原文网址:http://www.crifan.com/source_insight_support_highlight_for_python_ruby_arm_batch_ppc_sql_tcl_de ...
- 左侧菜单 z
Dev 的tabControl
- 实现两个N*N矩阵的乘法,矩阵由一维数组表示
实现两个N*N矩阵的乘法,矩阵由一维数组表示. 先介绍一下矩阵的加法: void Add(int rows, int cols) { ;i<rows;i++) { ;j<cols;j++) ...
- 【LR】安装LR11后遇到的问题
(1)问题:录制脚本时无法弹出IE浏览器 解决方法: 正确的是C:\Program Files (x86)\Internet Explorer\iexplore.exe 错误是:C:\Program ...