`

Spring配置项之<aop:aspectj-autoproxy />

阅读更多
通过配置织入@Aspectj切面

虽然可以通过编程的方式织入切面,但是一般情况下,我们还是使用spring的配置自动完成创建代理织入切面的工作。

通过aop命名空间的<aop:aspectj-autoproxy
/>声明自动为spring容器中那些配置@aspectJ切面的bean创建代理,织入切面。当然,spring

在内部依旧采用AnnotationAwareAspectJAutoProxyCreator进行自动代理的创建工作,但具体实现的细节已经被<aop:aspectj-autoproxy
/>隐藏起来了

<aop:aspectj-autoproxy
/>有一个proxy-target-class属性,默认为false,表示使用jdk动态代理织入增强,当配为<aop:aspectj-autoproxy 
poxy-target-class="true"/>时,表示使用CGLib动态代理技术织入增强。不过即使proxy-target-class设置为false,如果目标类没有声明接口,则spring将自动使用CGLib动态代理。

参考:http://www.blogjava.net/fanjs2000/archive/2012/04/25/376552.html

AOP 之 6.4 基于@AspectJ的AOP ——跟我学spring: http://sishuok.com/forum/blogPost/list/0/2471.html
分享到:
评论
3 楼 zmzyj666 2017-04-21  
wangchen100 写道
asd

wangchen100 写道
asd
wangchen100 写道
asd
wangchen100 写道
asd
wangchen100 写道
asd
wangchen100 写道
asd
wangchen100 写道
asd
wangchen100 写道
asd
wangchen100 写道
asd
wangchen100 写道
asd
2 楼 wangchen100 2017-03-09  
asdasdasd
1 楼 wangchen100 2017-03-09  
asd

相关推荐

    基于java的企业级应用开发:AspectJ开发.ppt

    基于XML的声明式AspectJ &lt;aop:config&gt;元素及其子元素如下: 小提示:图中灰色部分标注的元素即为常用的配置元素 XML文件中常用元素的配置方式如下: 基于XML的声明式AspectJ &lt;bean id="myAspect" class=...

    11spring4_aop3.rar

    第三种实现方法—通过注解来实现 签名 注解实现aop &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" ... &lt;aop:aspectj-autoproxy/&gt; &lt;/beans&gt;

    spring-aop-5.2.0.RELEASE-API文档-中文版.zip

    赠送jar包:spring-aop-5.2.0.RELEASE.jar; 赠送原API文档:spring-aop-5.2.0.RELEASE-javadoc.jar; 赠送源代码:spring-aop-5.2.0.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-aop-5.2.0.RELEASE.pom;...

    Spring实现AOP的四种方式

    配置可以通过xml文件来进行,大概有四种方式: 1. 配置ProxyFactoryBean,显式地设置advisors, advice, target等(基于代理的AOP ) ...4. 通过&lt;aop: aspectj-autoproxy&gt;来配置,使用AspectJ的注解来标识通知及切入点

    Spring AOP配置源码

    @Component("userService")等价于在spring配置文件中定义一个&lt;bean id="userService"/&gt; @Resource(name="userDAO")将userDA注入进来 写一个拦截器的类 package com.spring.aop; import org.springframework....

    spring-aop-5.0.10.RELEASE-API文档-中文版.zip

    赠送jar包:spring-aop-5.0.10.RELEASE.jar; 赠送原API文档:spring-aop-5.0.10.RELEASE-javadoc.jar; 赠送源代码:spring-aop-5.0.10.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-aop-5.0.10.RELEASE....

    springmvcmybatis

    http://www.springframework.org/schema/aop/spring-aop-3.1.xsd "&gt; &lt;!-- 自动扫描 --&gt; &lt;context:component-scan base-package="com.flong.*" /&gt; &lt;!-- 引入配置文件 --&gt; &lt;bean id="propertyConfigurer" ...

    spring框架手动提交事务,jdbctample

    &lt;aop:aspectj-autoproxy proxy-target-class="true"&gt;&lt;/aop:aspectj-autoproxy&gt; xml中要有这句,可以解决子类类报错的问题。 或者去掉这句话,同时去掉public class AccountServiceImpl implements AccountService {...

    spring applicationContext 配置文件

    &lt;description&gt;Spring公共配置文件&lt;/description&gt; &lt;!-- mes 的數據庫 --&gt; &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt; &lt;property name="driverClass" ...

    基于MyEclipse搭建maven+springmvc整合图文教程(含源码0

    &lt;groupId&gt;aspectj&lt;/groupId&gt; &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt; &lt;version&gt;1.5.4&lt;/version&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;...

    Spring3中配置DBCP,C3P0,Proxool,Bonecp数据源

    在Spring3中配置数据源,包括DBCP,C3P0,Proxool,Bonecp主要的数据源,里面包含这些数据源的jar文件和依赖文件及配置文件。。 如Bonecp目前听说是最快的数据源,速度是传统的c3p0的25倍, bonecp.properties文件: ...

    Spring2.5使用AOP需要的aspectJ

    Spring2.5开发 如果我们用到了AOP的话 一定需要aspectjrt.jar + aspectjweaver.jar 两个jar文件 这里面提供了 导入这两个就可以进行AOP开发了

    基于springboot演示resuful api、mock请求、validate验证、异常捕捉、aop切面编程+源代码+文档说

    &lt;artifactId&gt;spring-boot-starter-aop&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.data&lt;/groupId&gt; &lt;artifactId&gt;spring-data-commons&lt;/artifactId&gt; &lt;version&gt;${data-commons....

    struts2.3+hibernate3.6+spring3.1整合的纯xml配置的小项目

    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"&gt; &lt;context:...

    spring3.2+strut2+hibernate4

    &lt;description&gt;Spring公共配置文件&lt;/description&gt; &lt;!-- 启用spring注解支持 --&gt; &lt;context:annotation-config /&gt; &lt;!-- &lt;bean id="sessionFactory"--&gt; &lt;!-- class="org.springframework.orm.hibernate3....

    springmvc-ibatis

    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd ...

    Spring + Hibernate + Struts 事务配置小例子(带提示框等小技巧)

    class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"&gt; &lt;!-- 指定对满足哪些bean name的bean自动生成业务代理 --&gt; &lt;property name="beanNames"&gt; &lt;!-- 下面是所有需要自动创建...

    spring-aop-5.3.10-API文档-中文版.zip

    赠送jar包:spring-aop-5.3.10.jar; 赠送原API文档:spring-aop-5.3.10-javadoc.jar; 赠送源代码:spring-aop-5.3.10-sources.jar; 赠送Maven依赖信息文件:spring-aop-5.3.10.pom; 包含翻译后的API文档:spring...

    ssh框架在application.xml中配置数据源所需jar

    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd ...

Global site tag (gtag.js) - Google Analytics