Skip to content

Commit

Permalink
fix AOP error
Browse files Browse the repository at this point in the history
  • Loading branch information
fulan.zjf committed May 28, 2021
1 parent 4d1e402 commit 0acda5c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import com.alibaba.cola.extension.*;

import org.springframework.aop.support.AopUtils;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.ClassUtils;
Expand All @@ -30,6 +31,9 @@ public class ExtensionRegister{

public void doRegistration(ExtensionPointI extensionObject){
Class<?> extensionClz = extensionObject.getClass();
if (AopUtils.isAopProxy(extensionObject)) {
extensionClz = ClassUtils.getUserClass(extensionObject);
}
Extension extensionAnn = AnnotationUtils.findAnnotation(extensionClz, Extension.class);
BizScenario bizScenario = BizScenario.valueOf(extensionAnn.bizId(), extensionAnn.useCase(), extensionAnn.scenario());
ExtensionCoordinate extensionCoordinate = new ExtensionCoordinate(calculateExtensionPoint(extensionClz), bizScenario.getUniqueIdentity());
Expand All @@ -55,4 +59,4 @@ private String calculateExtensionPoint(Class<?> targetClz) {
throw new RuntimeException("Your name of ExtensionPoint for "+targetClz+" is not valid, must be end of "+ EXTENSION_EXTPT_NAMING);
}

}
}

0 comments on commit 0acda5c

Please sign in to comment.