程序包 net.risesoft.id

类 Y9SpringContext

  • 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.EnvironmentAware

    public class Y9SpringContext
    extends Object
    implements org.springframework.context.ApplicationContextAware, org.springframework.context.EnvironmentAware
    获取WebApplicationContext的一条途径
    • 构造器详细资料

      • Y9SpringContext

        public Y9SpringContext()
    • 方法详细资料

      • containsBean

        public static boolean containsBean​(String name)
        如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
        参数:
        name - the name of the bean to query
        返回:
        boolean whether a bean with the given name is present
      • getAc

        public static org.springframework.context.ApplicationContext getAc()
      • getAliases

        public static String[] getAliases​(String name)
                                   throws org.springframework.beans.factory.NoSuchBeanDefinitionException
        如果给定的bean名字在bean定义中有别名,则返回这些别名
        参数:
        name - the bean name to check for aliases
        返回:
        the aliases, or an empty array if none
        抛出:
        org.springframework.beans.factory.NoSuchBeanDefinitionException - – if there is no bean with the given name
      • getBean

        public static <T> T getBean​(Class<T> clz)
                             throws org.springframework.beans.BeansException
        获取类型为requiredType的对象
        类型参数:
        T - an interface or superclass
        参数:
        clz - ype the bean must match; can be an interface or superclass
        返回:
        an instance of the single bean matching the required type
        抛出:
        org.springframework.beans.BeansException - -if the bean could not be created
      • getBean

        public static <T> T getBean​(String name)
                             throws org.springframework.beans.BeansException
        获取对象
        类型参数:
        T - an interface or superclass
        参数:
        name - the name of the bean to retrieve
        返回:
        Object 一个以所给名字注册的bean的实例
        抛出:
        org.springframework.beans.BeansException - -if the bean could not be created
      • getEnvironment

        public static org.springframework.core.env.Environment getEnvironment()
      • setEnvironment

        public void setEnvironment​(org.springframework.core.env.Environment environment)
        指定者:
        setEnvironment 在接口中 org.springframework.context.EnvironmentAware
      • getProperty

        public static String getProperty​(String key)
      • getType

        public static Class<?> getType​(String name)
                                throws org.springframework.beans.factory.NoSuchBeanDefinitionException
        Determine the type of the bean with the given name. More specifically, determine the type of object that getBean would return for the given name.
        参数:
        name - he name of the bean to query
        返回:
        Class 注册对象的类型
        抛出:
        org.springframework.beans.factory.NoSuchBeanDefinitionException - – if there is no bean with the given name
      • isSingleton

        public static boolean isSingleton​(String name)
                                   throws org.springframework.beans.factory.NoSuchBeanDefinitionException
        判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
        参数:
        name - – the name of the bean to query
        返回:
        boolean whether this bean corresponds to a singleton instance
        抛出:
        org.springframework.beans.factory.NoSuchBeanDefinitionException - – if there is no bean with the given name
      • publishEvent

        public static void publishEvent​(org.springframework.context.ApplicationEvent event)
      • setApplicationContext

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