com.github.datalking.aop.framework.DynamicAdvisedInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of play-ioc Show documentation
Show all versions of play-ioc Show documentation
simple ioc container with aop support.
The newest version!
package com.github.datalking.aop.framework;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
/**
* 基于CGLIB实现动态织入
*
* @author yaoo on 4/19/18
*/
public class DynamicAdvisedInterceptor implements MethodInterceptor, Serializable {
private final AdvisedSupport advised;
public DynamicAdvisedInterceptor(AdvisedSupport advised) {
this.advised = advised;
}
/**
* 为Bean的切点方法进行Advisor动态织入
*/
@Override
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
Class> targetClass = null;
Object target = advised.getTargetSource().getTarget();
if (target != null) {
targetClass = target.getClass();
}
// 获取拦截器链
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy