支持非配置的ioc
<context:spring-configured />
支持注解的配置
<context:annotation-config />
类加载期织入
<context:load-time-weaver />
aop.xml。这个文件要求放在META-INF/aop.xml路径下,以告知AspectJ Weaver我们需要把ProfilingAspect织入到应用的哪些类中。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<weaver>
<!-- only weave classes in your application-specific packages -->
<include within="org.codetree.core.spring.loadtimeweaver.*" />
</weaver>
<aspects>
<!-- weave in just these aspects -->
<aspect name="org.codetree.core.spring.loadtimeweaver.ProfileAspect" />
</aspects>
</aspectj>
,她的核心方法为喜欢帅哥,但是我们又要为该方法添加一个新的功能,建立一个新的雌性类,该类中的方法为非常喜欢吃,把此功能添加到原目标类中。
AOP:概念
相关术语:target目标类
proxy 代理
joinpoint代理
ponitcut 切点
advice增强
advisor切面
weaving织入
introduction 引入
增强类型:
before advice前置增强
after advice后置增强
around advice环绕增强
throws advice 抛出增强
introduction advice引入增强
方案:
写死代码
静态代理
动态代理:
jdk动态代理
cglib动态代理
spring aop编程式 基于aop接口
声明式:手动代理
自动代理 扫描bean名称
扫描切面配置
spring aspectj:基于注解基于aspect
基于配置基于aop:config