|
24 | 24 | import org.minbox.framework.api.boot.plugin.resource.load.loader.ResourceFieldLoader; |
25 | 25 | import org.minbox.framework.api.boot.plugin.resource.load.model.ResourcePushField; |
26 | 26 | import org.springframework.util.ObjectUtils; |
| 27 | +import org.springframework.util.ReflectionUtils; |
27 | 28 |
|
28 | 29 | import java.lang.reflect.Field; |
29 | 30 | import java.lang.reflect.Method; |
@@ -156,12 +157,12 @@ else if (resourceField.isList()) { |
156 | 157 | * @return |
157 | 158 | * @throws NoSuchFieldException |
158 | 159 | */ |
159 | | - private static Field getSourceField(Method method, Class objectClass, String sourceFieldName,String resourceFieldName) throws NoSuchFieldException { |
| 160 | + private static Field getSourceField(Method method, Class objectClass, String sourceFieldName, String resourceFieldName) throws NoSuchFieldException { |
160 | 161 | // cache from memory |
161 | 162 | ResourcePushField resourcePushField = ApiBootResourceContext.getPushFieldFromCache(method, resourceFieldName); |
162 | 163 | // if don't have source field from cache |
163 | 164 | if (ObjectUtils.isEmpty(resourcePushField) || ObjectUtils.isEmpty(resourcePushField.getSourceField())) { |
164 | | - Field sourceField = objectClass.getDeclaredField(sourceFieldName); |
| 165 | + Field sourceField = ReflectionUtils.findField(objectClass, sourceFieldName); |
165 | 166 | if (!sourceField.isAccessible()) { |
166 | 167 | sourceField.setAccessible(true); |
167 | 168 | } |
@@ -189,7 +190,7 @@ private static Field getResourceField(Method method, Class objectClass, String r |
189 | 190 | ResourcePushField resourcePushField = ApiBootResourceContext.getPushFieldFromCache(method, resourceFieldName); |
190 | 191 | // if don't have source field from cache |
191 | 192 | if (ObjectUtils.isEmpty(resourcePushField) || ObjectUtils.isEmpty(resourcePushField.getResourceField())) { |
192 | | - Field resourceFieldInstance = objectClass.getDeclaredField(resourceFieldName); |
| 193 | + Field resourceFieldInstance = ReflectionUtils.findField(objectClass, resourceFieldName); |
193 | 194 | if (!resourceFieldInstance.isAccessible()) { |
194 | 195 | resourceFieldInstance.setAccessible(true); |
195 | 196 | } |
|
0 commit comments