mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-15 04:22:09 +08:00
bug #I61HIO 方法级的组件声明,然后在方法上打 Spring 的事务注解 @Transactional,会报错
This commit is contained in:
@@ -70,7 +70,7 @@ public class ComponentProxy {
|
||||
|
||||
return methodListMap.entrySet().stream().map(entry -> {
|
||||
// 获取当前节点的原有注解,如:LiteFlowRetry 之类的规则注解
|
||||
Annotation[] beanClassAnnotation = bean.getClass().getAnnotations();
|
||||
Annotation[] beanClassAnnotation = beanClazz.getAnnotations();
|
||||
// 如果entry的key为空字符串,则是为了兼容老版本的写法,即:没有指定nodeId的情况
|
||||
// 判断是否是方法级创造节点
|
||||
boolean isMethodCreate = !StrUtil.isEmpty(entry.getKey());
|
||||
@@ -139,7 +139,7 @@ public class ComponentProxy {
|
||||
//被拦截的对象也根据被代理对象根据@LiteFlowMethod所标注的进行了动态判断
|
||||
Object instance = new ByteBuddy().subclass(cmpClazz)
|
||||
.name(StrUtil.format("{}.ByteBuddy${}${}",
|
||||
ClassUtil.getPackage(bean.getClass()),
|
||||
ClassUtil.getPackage(beanClazz),
|
||||
activeNodeId,
|
||||
SerialsUtil.generateShortUUID()))
|
||||
.method(ElementMatchers.namedOneOf(methodList.stream().map(m -> m.value().getMethodName()).toArray(String[]::new)))
|
||||
@@ -163,8 +163,11 @@ public class ComponentProxy {
|
||||
|
||||
private final Object bean;
|
||||
|
||||
private final Class<?> clazz;
|
||||
|
||||
public AopInvocationHandler(Object bean) {
|
||||
this.bean = bean;
|
||||
this.clazz = LiteFlowProxyUtil.getUserClass(bean.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -172,7 +175,7 @@ public class ComponentProxy {
|
||||
//这里做了2件事情
|
||||
//先是从普通的bean里过滤出含有@LiteFlowMethod这个标注的方法
|
||||
//然后进行转换成LiteFlowMethodBean对象List,形成<methodName,Method>键值对的对象
|
||||
List<LiteFlowMethodBean> liteFlowMethodBeanList = Arrays.stream(ReflectUtil.getMethods(bean.getClass())).filter(m -> {
|
||||
List<LiteFlowMethodBean> liteFlowMethodBeanList = Arrays.stream(ReflectUtil.getMethods(clazz)).filter(m -> {
|
||||
LiteflowMethod liteFlowMethod = m.getAnnotation(LiteflowMethod.class);
|
||||
return ObjectUtil.isNotNull(liteFlowMethod);
|
||||
}).filter(m -> {
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.*;
|
||||
import com.yomahub.liteflow.util.LiteFlowProxyUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -124,6 +125,10 @@ public enum NodeTypeEnum {
|
||||
}
|
||||
|
||||
public static NodeTypeEnum guessType(Class<?> clazz) {
|
||||
if(LiteFlowProxyUtil.isCglibProxyClass(clazz)){
|
||||
clazz = LiteFlowProxyUtil.getUserClass(clazz);
|
||||
}
|
||||
|
||||
NodeTypeEnum nodeType = guessTypeBySuperClazz(clazz);
|
||||
if (nodeType == null) {
|
||||
//尝试从类声明处进行推断
|
||||
|
||||
Reference in New Issue
Block a user