项目中用到返回数据量大,而业务逻辑中又使用
BeanUtils.getProperty(t, parentFieldName) 来封装的工具类,导致返回数据接口响应慢
package com.loit.v1.api.util;
import org.springframework.beans.BeanUtils;
import org.springframework.util.Assert;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
public class LoitBeanCacheUtils extends BeanUtils {
static final ConcurrentHashMap<LoitBeanCacheUtils.MyKey, List<LoitBeanCacheUtils.MyValue>> myCache = new ConcurrentHashMap<>();
public static void copyWhiteListFields(Object from, Object to, String[] whiteList) {
Assert.notNull(whiteList, "whiteList is null");
handle(from, to, whiteList, false);
}
public static void copyFields(Object from, Object to, String... ignores) {
Assert.notNull(from, "from i