今天在调试spring aop程序时,起初认为context:component-scan部分是扫描@Component,因此其base-page 配置成@Component的包,结果怎么也出不来结果,到spring官方论坛上看到有人求助类似的问题,看到他的配置里面多了一个<bean id="loginAspect" class="com.aabnn.aspect.LogAspect"/>,就把他的拷贝过来,结果出来了,非常高兴。下午吃完饭,又开始调试,弄明白了起初理解的不对, <context:component-scan base-package="com.aabnn.aspect">
<context:include-filter type="annotation"
expression="org.aspectj.lang.annotation.Aspect" />
</context:component-scan>和<bean id="loginAspect" class="com.aabnn.aspect.LogAspect"/>原来实现相同的功能。同时也发现
<aop:aspectj-autoproxy/>和
<bean class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"/>实现的也是相同的功能。
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-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/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
">
<aop:aspectj-autoproxy/>
<!--启用spring对@AspectJ风格的切面配置支持,有两种方式,一种是上面的基于xml命名空间的方式,另一种是以bean的方式配置在容器中,如下面所示。 -->
<bean class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"/>
<context:component-scan base-package="com.aabnn.aspect">
<context:include-filter type="annotation"
expression="org.aspectj.lang.annotation.Aspect" />
</context:component-scan>
<!--切面配置的两种方式,一种是上面的基于xml命名空间的方式,一种是下面这种以bean的方式配置在容器中。 -->
<bean id="loginAspect" class="com.aabnn.aspect.LogAspect"/>
<bean id="chinesePerson" class="com.aabnn.entity.Chinese"/>
</beans>
分享到:
相关推荐
spring aop spring aop spring aop spring aop spring aop spring aop spring aop spring aop spring aop
spring aop jar 包
spring-aop-1.1.1.jar spring-aop-1.2.6.jar spring-aop-1.2.9.jar spring-aop-2.0.2.jar spring-aop-2.0.6.jar spring-aop-2.0.7.jar spring-aop-2.0.8.jar spring-aop-2.0.jar spring-aop-2.5.1.jar spring-aop-...
springAOP所需jar包 springAOP所需jar包 springAOP所需jar包 springAOP所需jar包 springAOP所需jar包
在Spring AOP中关注点(concern)和横切关注点(cross-cutting concern)有什么不同? AOP有哪些可用的实现? Spring中有哪些不同的通知类型(advice types)? Spring AOP 代理是什么? 引介(Introduction)是什么? 连接...
基于注解实现SpringAop基于注解实现SpringAop基于注解实现SpringAop
死磕Spring之AOP篇 - Spring AOP两种代理对象的拦截处理(csdn)————程序
spring AOP 理论知识点总结.wpsspring AOP 理论知识点总结.wpsspring AOP 理论知识点总结.wps
一、适合人群 1、具备一定Java编程基础,初级开发者 2、对springboot,mybatis,mysql有基本认识 3、对spring aop认识模糊的,不清楚如何实现Java 自定义注解的 ...4、spring boot,mybatis,druid,spring aop的使用
spring aop编程所需要的一些开发jar包,需配合spring基本jar运行.
spring aop的demo spring aop的demo
Spring框架的关键组件之一是面向方面编程(AOP)框架。 面向方面的编程需要将程序逻辑分解成不同的部分。 此教程将通过简单实用的方法来学习Spring框架提供的AOP/面向方面编程。
spring aop
开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE开发工具 spring-aop-4.3.6.RELEASE...
Spring是一个轻量级的控制反转(IoC)和面向切面(AOP)的容器...Spring AOP 模块为基于 Spring 的应用程序中的对象提供了事务管理服务。通过使用 Spring AOP,不用依赖 EJB 组件,就可以将声明性事务管理集成到应用程序中
springAop与spring定时器
通过对SRPING aop的使用和研究,总结出来的SPRING AOP使用原理,以及在使用spring aop过程中要注意的问题
Spring aop Spring aop
springAOP详解
springaop依赖的jar包,spring版本2.5.6,如果需要,可以下载使用,欢迎各位评论指出不足