类 SpringContextUtil

java.lang.Object
com.sh.spring.util.SpringContextUtil
所有已实现的接口:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Component public class SpringContextUtil extends Object implements org.springframework.context.ApplicationContextAware
  • 构造器详细资料

    • SpringContextUtil

      public SpringContextUtil()
  • 方法详细资料

    • setApplicationContext

      @Autowired public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      指定者:
      setApplicationContext 在接口中 org.springframework.context.ApplicationContextAware
      抛出:
      org.springframework.beans.BeansException
    • getApplicationContext

      public static org.springframework.context.ApplicationContext getApplicationContext()
      获取applicationContext
      返回:
    • updateEnvironmentValue

      public static void updateEnvironmentValue(org.springframework.context.ApplicationContext applicationContext, String key, String value)
      更新变量值
      参数:
      applicationContext -
      key -
      value -
    • getBean

      public static Object getBean(String name)
      通过name获取 Bean.
      参数:
      name -
      返回:
    • getBean

      public static <T> T getBean(Class<T> clazz)
      通过class获取Bean.
      类型参数:
      T -
      参数:
      clazz -
      返回:
    • getBean

      public static <T> T getBean(String name, Class<T> clazz)
      通过name,以及Clazz返回指定的Bean
      类型参数:
      T -
      参数:
      name -
      clazz -
      返回:
    • getConfigDir

      public static String getConfigDir()
      获取config目录路径
      返回: