本文整理汇总了Java中org.springframework.beans.factory.support.AbstractBeanDefinitionReader类的典型用法代码示例。如果您正苦于以下问题:Java AbstractBeanDefinitionReader类的具体用法?Java AbstractBeanDefinitionReader怎么用?Java AbstractBeanDefinitionReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractBeanDefinitionReader类属于org.springframework.beans.factory.support包,在下文中一共展示了AbstractBeanDefinitionReader类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadBeanDefinitionsFromImportedResources
import org.springframework.beans.factory.support.AbstractBeanDefinitionReader; //导入依赖的package包/类
private void loadBeanDefinitionsFromImportedResources(final Map<String, Class<? extends BeanDefinitionReader>> importedResources) {
final Map<Class<?>, BeanDefinitionReader> readerInstanceCache = new HashMap<Class<?>, BeanDefinitionReader>();
for (final Map.Entry<String, Class<? extends BeanDefinitionReader>> entry : importedResources.entrySet()) {
final String resource = entry.getKey();
final Class<? extends BeanDefinitionReader> readerClass = entry.getValue();
if (!readerInstanceCache.containsKey(readerClass)) {
try {
// Instantiate the specified BeanDefinitionReader
final BeanDefinitionReader readerInstance = readerClass.getConstructor(BeanDefinitionRegistry.class).newInstance(this.registry);
// Delegate the current ResourceLoader to it if possible
if (readerInstance instanceof AbstractBeanDefinitionReader) {
final AbstractBeanDefinitionReader abdr = ((AbstractBeanDefinitionReader) readerInstance);
abdr.setResourceLoader(this.resourceLoader);
abdr.setEnvironment(this.environment);
}
readerInstanceCache.put(readerClass, readerInstance);
} catch (final Exception ex) {
throw new IllegalStateException("Could not instantiate BeanDefinitionReader class [" + readerClass.getName() + "]");
}
}
final BeanDefinitionReader reader = readerInstanceCache.get(readerClass);
// TODO SPR-6310: qualify relative path locations as done in AbstractContextLoader.modifyLocations
reader.loadBeanDefinitions(resource);
}
}
开发者ID:ahoehma,项目名称:spring-autowire-qualified-beans,代码行数:27,代码来源:ConfigurationClassBeanDefinitionReader.java
示例2: loadBeanDefinitionsFromImportedResources
import org.springframework.beans.factory.support.AbstractBeanDefinitionReader; //导入依赖的package包/类
private void loadBeanDefinitionsFromImportedResources(
Map<String, Class<? extends BeanDefinitionReader>> importedResources) {
Map<Class<?>, BeanDefinitionReader> readerInstanceCache = new HashMap<Class<?>, BeanDefinitionReader>();
for (Map.Entry<String, Class<? extends BeanDefinitionReader>> entry : importedResources.entrySet()) {
String resource = entry.getKey();
Class<? extends BeanDefinitionReader> readerClass = entry.getValue();
if (!readerInstanceCache.containsKey(readerClass)) {
try {
// Instantiate the specified BeanDefinitionReader
BeanDefinitionReader readerInstance =
readerClass.getConstructor(BeanDefinitionRegistry.class).newInstance(this.registry);
// Delegate the current ResourceLoader to it if possible
if (readerInstance instanceof AbstractBeanDefinitionReader) {
AbstractBeanDefinitionReader abdr = ((AbstractBeanDefinitionReader) readerInstance);
abdr.setResourceLoader(this.resourceLoader);
abdr.setEnvironment(this.environment);
}
readerInstanceCache.put(readerClass, readerInstance);
}
catch (Exception ex) {
throw new IllegalStateException(
"Could not instantiate BeanDefinitionReader class [" + readerClass.getName() + "]");
}
}
BeanDefinitionReader reader = readerInstanceCache.get(readerClass);
// TODO SPR-6310: qualify relative path locations as done in AbstractContextLoader.modifyLocations
reader.loadBeanDefinitions(resource);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:ConfigurationClassBeanDefinitionReader.java
示例3: loadBeanDefinitionsFromString
import org.springframework.beans.factory.support.AbstractBeanDefinitionReader; //导入依赖的package包/类
private int loadBeanDefinitionsFromString(String beanDefinition) {
AbstractBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(this.getRegistry());
Resource resource = new ByteArrayResource(beanDefinition.getBytes());
int count = beanDefinitionReader.loadBeanDefinitions(resource);
return count;
}
开发者ID:pulsarIO,项目名称:jetstream,代码行数:8,代码来源:MongoDataStoreReader.java
示例4: loadBeanDefinitions
import org.springframework.beans.factory.support.AbstractBeanDefinitionReader; //导入依赖的package包/类
@Override
protected void loadBeanDefinitions(UpdateableListableBeanFactory beanFactory) throws IOException, BeansException {
AbstractBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);
for (Resource resource : getConfigResources()) {
if (resource instanceof MongoDbResource) {
((MongoDbResource) resource).loadBeanDefinitions(beanFactory);
}
else {
beanDefinitionReader.loadBeanDefinitions(resource);
}
}
}
开发者ID:pulsarIO,项目名称:jetstream,代码行数:13,代码来源:Configuration.java
示例5: loadBeanDefinitionsFromImportedResources
import org.springframework.beans.factory.support.AbstractBeanDefinitionReader; //导入依赖的package包/类
private void loadBeanDefinitionsFromImportedResources(
Map<String, Class<? extends BeanDefinitionReader>> importedResources) {
Map<Class<?>, BeanDefinitionReader> readerInstanceCache = new HashMap<Class<?>, BeanDefinitionReader>();
for (Map.Entry<String, Class<? extends BeanDefinitionReader>> entry : importedResources.entrySet()) {
String resource = entry.getKey();
Class<? extends BeanDefinitionReader> readerClass = entry.getValue();
// Default reader selection necessary?
if (BeanDefinitionReader.class == readerClass) {
if (StringUtils.endsWithIgnoreCase(resource, ".groovy")) {
// When clearly asking for Groovy, that's what they'll get...
readerClass = GroovyBeanDefinitionReader.class;
}
else {
// Primarily ".xml" files but for any other extension as well
readerClass = XmlBeanDefinitionReader.class;
}
}
BeanDefinitionReader reader = readerInstanceCache.get(readerClass);
if (reader == null) {
try {
// Instantiate the specified BeanDefinitionReader
reader = readerClass.getConstructor(BeanDefinitionRegistry.class).newInstance(this.registry);
// Delegate the current ResourceLoader to it if possible
if (reader instanceof AbstractBeanDefinitionReader) {
AbstractBeanDefinitionReader abdr = ((AbstractBeanDefinitionReader) reader);
abdr.setResourceLoader(this.resourceLoader);
abdr.setEnvironment(this.environment);
}
readerInstanceCache.put(readerClass, reader);
}
catch (Exception ex) {
throw new IllegalStateException(
"Could not instantiate BeanDefinitionReader class [" + readerClass.getName() + "]");
}
}
// TODO SPR-6310: qualify relative path locations as done in AbstractContextLoader.modifyLocations
reader.loadBeanDefinitions(resource);
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:45,代码来源:ConfigurationClassBeanDefinitionReader.java
注:本文中的org.springframework.beans.factory.support.AbstractBeanDefinitionReader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论