zoukankan      html  css  js  c++  java
  • java 获取spring的代理对象

    import org.springframework.beans.BeansException;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.ApplicationContextAware;
    import org.springframework.stereotype.Component;


    @Component
    public class ProxyUtil implements ApplicationContextAware {

    private static ApplicationContext applicationContext = null;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    ProxyUtil.applicationContext = applicationContext;

    }

    public static <T> T getProxy(String name, Class<T> cls) {
    return applicationContext.getBean(name, cls);
    }

    public static <T> T getProxy(Class<T> cls) {
    return applicationContext.getBean(cls);
    }

    }

  • 相关阅读:
    MySQL详细操作
    啥是SQL?
    MySQL之中文乱码问题
    Windows压缩包安装MySQL
    GIL(全局解释器锁)
    协程
    线程
    第八周 编程作业
    PCA
    第八周 第一部分
  • 原文地址:https://www.cnblogs.com/jiehanshi/p/11269616.html
Copyright © 2011-2022 走看看