Skip to content

Commit

Permalink
Merge pull request #326 from hnxiaoyuan/master
Browse files Browse the repository at this point in the history
fix aop use jdk dynamic proxy NPE issue
  • Loading branch information
significantfrank authored Apr 16, 2024
2 parents 2d17e12 + 9bf3879 commit 22f6367
Showing 1 changed file with 3 additions and 2 deletions.
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.AnnotatedElementUtils;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.ClassUtils;
Expand Down Expand Up @@ -46,9 +47,9 @@ public class ExtensionRegister {
public void doRegistration(ExtensionPointI extensionObject) {
Class<?> extensionClz = extensionObject.getClass();
if (AopUtils.isAopProxy(extensionObject)) {
extensionClz = ClassUtils.getUserClass(extensionObject);
extensionClz = AopUtils.getTargetClass(extensionObject);
}
Extension extensionAnn = AnnotationUtils.findAnnotation(extensionClz, Extension.class);
Extension extensionAnn = AnnotatedElementUtils.findMergedAnnotation(extensionClz, Extension.class);
BizScenario bizScenario = BizScenario.valueOf(extensionAnn.bizId(), extensionAnn.useCase(), extensionAnn.scenario());
ExtensionCoordinate extensionCoordinate = new ExtensionCoordinate(calculateExtensionPoint(extensionClz), bizScenario.getUniqueIdentity());
ExtensionPointI preVal = extensionRepository.getExtensionRepo().put(extensionCoordinate, extensionObject);
Expand Down

0 comments on commit 22f6367

Please sign in to comment.