本文整理汇总了Java中org.springframework.core.env.EnvironmentCapable类的典型用法代码示例。如果您正苦于以下问题:Java EnvironmentCapable类的具体用法?Java EnvironmentCapable怎么用?Java EnvironmentCapable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnvironmentCapable类属于org.springframework.core.env包,在下文中一共展示了EnvironmentCapable类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: AbstractBeanDefinitionReader
import org.springframework.core.env.EnvironmentCapable; //导入依赖的package包/类
/**
* Create a new AbstractBeanDefinitionReader for the given bean factory.
* <p>If the passed-in bean factory does not only implement the BeanDefinitionRegistry
* interface but also the ResourceLoader interface, it will be used as default
* ResourceLoader as well. This will usually be the case for
* {@link org.springframework.context.ApplicationContext} implementations.
* <p>If given a plain BeanDefinitionRegistry, the default ResourceLoader will be a
* {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver}.
* <p>If the the passed-in bean factory also implements {@link EnvironmentCapable} its
* environment will be used by this reader. Otherwise, the reader will initialize and
* use a {@link StandardEnvironment}. All ApplicationContext implementations are
* EnvironmentCapable, while normal BeanFactory implementations are not.
* @param registry the BeanFactory to load bean definitions into,
* in the form of a BeanDefinitionRegistry
* @see #setResourceLoader
* @see #setEnvironment
*/
protected AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
this.registry = registry;
// Determine ResourceLoader to use.
if (this.registry instanceof ResourceLoader) {
this.resourceLoader = (ResourceLoader) this.registry;
}
else {
this.resourceLoader = new PathMatchingResourcePatternResolver();
}
// Inherit Environment if possible
if (this.registry instanceof EnvironmentCapable) {
this.environment = ((EnvironmentCapable) this.registry).getEnvironment();
}
else {
this.environment = new StandardEnvironment();
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:AbstractBeanDefinitionReader.java
示例2: AbstractBeanDefinitionReader
import org.springframework.core.env.EnvironmentCapable; //导入依赖的package包/类
/**
* Create a new AbstractBeanDefinitionReader for the given bean factory.
* <p>If the passed-in bean factory does not only implement the BeanDefinitionRegistry
* interface but also the ResourceLoader interface, it will be used as default
* ResourceLoader as well. This will usually be the case for
* {@link org.springframework.context.ApplicationContext} implementations.
* <p>If given a plain BeanDefinitionRegistry, the default ResourceLoader will be a
* {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver}.
* <p>If the passed-in bean factory also implements {@link EnvironmentCapable} its
* environment will be used by this reader. Otherwise, the reader will initialize and
* use a {@link StandardEnvironment}. All ApplicationContext implementations are
* EnvironmentCapable, while normal BeanFactory implementations are not.
* @param registry the BeanFactory to load bean definitions into,
* in the form of a BeanDefinitionRegistry
* @see #setResourceLoader
* @see #setEnvironment
*/
protected AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
this.registry = registry;
// Determine ResourceLoader to use.
if (this.registry instanceof ResourceLoader) {
this.resourceLoader = (ResourceLoader) this.registry;
}
else {
this.resourceLoader = new PathMatchingResourcePatternResolver();
}
// Inherit Environment if possible
if (this.registry instanceof EnvironmentCapable) {
this.environment = ((EnvironmentCapable) this.registry).getEnvironment();
}
else {
this.environment = new StandardEnvironment();
}
}
开发者ID:txazo,项目名称:spring,代码行数:38,代码来源:AbstractBeanDefinitionReader.java
示例3: testAppContextClassHierarchy
import org.springframework.core.env.EnvironmentCapable; //导入依赖的package包/类
public void testAppContextClassHierarchy() {
Class[] clazz = ClassUtils.getClassHierarchy(OsgiBundleXmlApplicationContext.class,
ClassUtils.INCLUDE_ALL_CLASSES);
Class[] expected = new Class[] { OsgiBundleXmlApplicationContext.class,
AbstractDelegatedExecutionApplicationContext.class, DelegatedExecutionOsgiBundleApplicationContext.class,
ConfigurableOsgiBundleApplicationContext.class, ConfigurableApplicationContext.class, ApplicationContext.class,
Lifecycle.class, Closeable.class, EnvironmentCapable.class, ListableBeanFactory.class,
HierarchicalBeanFactory.class, MessageSource.class, ApplicationEventPublisher.class,
ResourcePatternResolver.class, BeanFactory.class, ResourceLoader.class, AutoCloseable.class,
AbstractOsgiBundleApplicationContext.class, AbstractRefreshableApplicationContext.class,
AbstractApplicationContext.class, DisposableBean.class, DefaultResourceLoader.class };
String msg = "Class: ";
for (int i=0;i<clazz.length;i++) {
msg += clazz[i].getSimpleName() + " ";
}
assertTrue(msg, compareArrays(expected, clazz));
}
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:19,代码来源:ClassUtilsTest.java
示例4: testInterfacesHierarchy
import org.springframework.core.env.EnvironmentCapable; //导入依赖的package包/类
public void testInterfacesHierarchy() {
//Closeable.class,
Class<?>[] clazz = ClassUtils.getAllInterfaces(DelegatedExecutionOsgiBundleApplicationContext.class);
Class<?>[] expected =
{ ConfigurableOsgiBundleApplicationContext.class, ConfigurableApplicationContext.class,
ApplicationContext.class, Lifecycle.class, Closeable.class, EnvironmentCapable.class, ListableBeanFactory.class,
HierarchicalBeanFactory.class, MessageSource.class, ApplicationEventPublisher.class,
ResourcePatternResolver.class, BeanFactory.class, ResourceLoader.class, AutoCloseable.class };
assertTrue(compareArrays(expected, clazz));
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:12,代码来源:ClassUtilsTest.java
示例5: testAppContextClassHierarchy
import org.springframework.core.env.EnvironmentCapable; //导入依赖的package包/类
public void testAppContextClassHierarchy() {
Class<?>[] clazz =
ClassUtils.getClassHierarchy(OsgiBundleXmlApplicationContext.class, ClassUtils.ClassSet.ALL_CLASSES);
//Closeable.class,
Class<?>[] expected =
new Class<?>[] { OsgiBundleXmlApplicationContext.class,
AbstractDelegatedExecutionApplicationContext.class, AbstractOsgiBundleApplicationContext.class,
AbstractRefreshableApplicationContext.class, AbstractApplicationContext.class,
DefaultResourceLoader.class, ResourceLoader.class,
AutoCloseable.class,
DelegatedExecutionOsgiBundleApplicationContext.class,
ConfigurableOsgiBundleApplicationContext.class, ConfigurableApplicationContext.class,
ApplicationContext.class, Lifecycle.class, Closeable.class, EnvironmentCapable.class, ListableBeanFactory.class,
HierarchicalBeanFactory.class, ApplicationEventPublisher.class, ResourcePatternResolver.class,
MessageSource.class, BeanFactory.class, DisposableBean.class };
assertTrue(compareArrays(expected, clazz));
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:20,代码来源:ClassUtilsTest.java
示例6: getOrCreateEnvironment
import org.springframework.core.env.EnvironmentCapable; //导入依赖的package包/类
/**
* Get the Environment from the given registry if possible, otherwise return a new
* StandardEnvironment.
*/
private static Environment getOrCreateEnvironment(BeanDefinitionRegistry registry) {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
if (registry instanceof EnvironmentCapable) {
return ((EnvironmentCapable) registry).getEnvironment();
}
return new StandardEnvironment();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:AnnotatedBeanDefinitionReader.java
示例7: testInterfacesHierarchy
import org.springframework.core.env.EnvironmentCapable; //导入依赖的package包/类
public void testInterfacesHierarchy() {
Class[] clazz = ClassUtils.getAllInterfaces(DelegatedExecutionOsgiBundleApplicationContext.class);
Class[] expected = { ConfigurableOsgiBundleApplicationContext.class, ConfigurableApplicationContext.class,
ApplicationContext.class, Lifecycle.class, Closeable.class, EnvironmentCapable.class,
ListableBeanFactory.class, HierarchicalBeanFactory.class, MessageSource.class, ApplicationEventPublisher.class,
ResourcePatternResolver.class, BeanFactory.class, ResourceLoader.class, AutoCloseable.class };
String msg = "Class: ";
for (int i=0;i<clazz.length;i++) {
msg += clazz[i].getSimpleName() + " ";
}
assertTrue(msg, compareArrays(expected, clazz));
}
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:14,代码来源:ClassUtilsTest.java
示例8: deduceEnvironment
import org.springframework.core.env.EnvironmentCapable; //导入依赖的package包/类
private Environment deduceEnvironment(BeanDefinitionRegistry source) {
if (source instanceof EnvironmentCapable) {
return ((EnvironmentCapable) source).getEnvironment();
}
return null;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:ConditionEvaluator.java
注:本文中的org.springframework.core.env.EnvironmentCapable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论