All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.binfast.adpter.core.kit.ClassKit Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package com.binfast.adpter.core.kit;

import org.springframework.context.ApplicationContext;
import org.springframework.util.ClassUtils;

import java.lang.reflect.Proxy;

/**
 * @author 刘斌
 * @date 2022/11/28 11:28 上午
 */
public class ClassKit {

    public static Class getCurrentByType(ApplicationContext applicationContext, String name) {
        Class type = applicationContext.getType(name);
        if (type == null) {
            return null;
        }
        boolean cglibProxy = Proxy.isProxyClass(type) || type.getName().contains("$$");
        if (cglibProxy) {
            type = ClassUtils.getUserClass(type);
        }
        return type;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy