From 7a2f8ca0ada099fce9a155acb78059f5c1adfe2d Mon Sep 17 00:00:00 2001 From: wangyu <727842003@qq.com> Date: Sun, 10 Jan 2021 15:50:16 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E5=90=AF=E7=94=A8jwt=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flyfish/framework/beans/meta/BeanProperty.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java index eeca7da..a7e6d00 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java @@ -60,7 +60,7 @@ public class BeanProperty { */ public static BeanProperty form(PropertyDescriptor descriptor, Class beanClass) { // 尝试获取field - Field field = FieldUtils.getDeclaredField(beanClass, descriptor.getName(), true); + Field field = FieldUtils.getField(beanClass, descriptor.getName(), true); // 存在field,可以干一些坏事 BeanProperty property = new BeanProperty(); property.setName(descriptor.getName()); @@ -82,10 +82,12 @@ public class BeanProperty { } else if (property.getType() == BeanPropertyType.DB_REF) { // 当存在db-ref时,解析为动态数据源 RestBean restBean = clazz.getAnnotation(RestBean.class); - String uri = restBean.value(); - Map props = new HashMap<>(); - props.put("uri", uri); - property.setProps(props); + if (null != restBean) { + String uri = restBean.value(); + Map props = new HashMap<>(); + props.put("uri", uri); + property.setProps(props); + } } return property; }