程序包 net.risesoft.id
类 Y9SpringContext
- java.lang.Object
-
- 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()
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static booleancontainsBean(String name)如果BeanFactory包含一个与所给名称匹配的bean定义,则返回truestatic org.springframework.context.ApplicationContextgetAc()static String[]getAliases(String name)如果给定的bean名字在bean定义中有别名,则返回这些别名static <T> TgetBean(Class<T> clz)获取类型为requiredType的对象static <T> TgetBean(String name)获取对象static org.springframework.core.env.EnvironmentgetEnvironment()static StringgetProperty(String key)static StringgetProperty(String key, String defaultValue)static Class<?>getType(String name)Determine the type of the bean with the given name.static booleanisSingleton(String name)判断以给定名字注册的bean定义是一个singleton还是一个prototype。static voidpublishEvent(org.springframework.context.ApplicationEvent event)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)voidsetEnvironment(org.springframework.core.env.Environment environment)
-
-
-
方法详细资料
-
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
-
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
-
-