本文整理汇总了Java中org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader类的典型用法代码示例。如果您正苦于以下问题:Java GroovyBeanDefinitionReader类的具体用法?Java GroovyBeanDefinitionReader怎么用?Java GroovyBeanDefinitionReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GroovyBeanDefinitionReader类属于org.springframework.beans.factory.groovy包,在下文中一共展示了GroovyBeanDefinitionReader类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadBeanDefinitions
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
/**
* Loads the bean definitions via an GroovyBeanDefinitionReader.
* @see org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader
* @see #initBeanDefinitionReader
* @see #loadBeanDefinitions
*/
@Override
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException, IOException {
// Create a new XmlBeanDefinitionReader for the given BeanFactory.
GroovyBeanDefinitionReader beanDefinitionReader = new GroovyBeanDefinitionReader(beanFactory);
// Configure the bean definition reader with this context's
// resource loading environment.
beanDefinitionReader.setEnvironment(getEnvironment());
beanDefinitionReader.setResourceLoader(this);
// Allow a subclass to provide custom initialization of the reader,
// then proceed with actually loading the bean definitions.
initBeanDefinitionReader(beanDefinitionReader);
loadBeanDefinitions(beanDefinitionReader);
}
示例2: BeanDefinitionLoader
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
/**
* Create a new {@link BeanDefinitionLoader} that will load beans into the specified
* {@link BeanDefinitionRegistry}.
* @param registry the bean definition registry that will contain the loaded beans
* @param sources the bean sources
*/
BeanDefinitionLoader(BeanDefinitionRegistry registry, Object... sources) {
Assert.notNull(registry, "Registry must not be null");
Assert.notEmpty(sources, "Sources must not be empty");
this.sources = sources;
this.annotatedReader = new AnnotatedBeanDefinitionReader(registry);
this.xmlReader = new XmlBeanDefinitionReader(registry);
if (isGroovyPresent()) {
this.groovyReader = new GroovyBeanDefinitionReader(registry);
}
this.scanner = new ClassPathBeanDefinitionScanner(registry);
this.scanner.addExcludeFilter(new ClassExcludeFilter(sources));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:BeanDefinitionLoader.java
示例3: initGroovyConf
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
private static void initGroovyConf(GenericApplicationContext context){
String classPath=ProcessInfo.getGroovyClassPath();
if(Help.isNotEmpty(classPath)){
GroovyBeanDefinitionReader reader=new GroovyBeanDefinitionReader(context);
reader.loadBeanDefinitions(new ClassPathResource(classPath));
}
}
示例4: createBeanDefinitionReader
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
@Override
protected BeanDefinitionReader createBeanDefinitionReader(
GenericApplicationContext context) {
return new GroovyBeanDefinitionReader(context);
}
示例5: loadBeanDefinitionsFromImportedResources
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的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
示例6: load
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
private int load(GroovyBeanDefinitionSource source) {
int before = this.xmlReader.getRegistry().getBeanDefinitionCount();
((GroovyBeanDefinitionReader) this.groovyReader).beans(source.getBeans());
int after = this.xmlReader.getRegistry().getBeanDefinitionCount();
return after - before;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:BeanDefinitionLoader.java
示例7: getReader
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
/**
* Exposes the underlying {@link GroovyBeanDefinitionReader} for convenient access
* to the {@code loadBeanDefinition} methods on it as well as the ability
* to specify an inline Groovy bean definition closure.
* @see GroovyBeanDefinitionReader#loadBeanDefinitions(org.springframework.core.io.Resource...)
* @see GroovyBeanDefinitionReader#loadBeanDefinitions(String...)
*/
public final GroovyBeanDefinitionReader getReader() {
return this.reader;
}
示例8: initBeanDefinitionReader
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
/**
* Initialize the bean definition reader used for loading the bean
* definitions of this context. Default implementation is empty.
* <p>Can be overridden in subclasses.
* @param beanDefinitionReader the bean definition reader used by this context
*/
protected void initBeanDefinitionReader(GroovyBeanDefinitionReader beanDefinitionReader) {
}
示例9: loadBeanDefinitions
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
/**
* Load bean definitions into the supplied {@link GenericWebApplicationContext context}
* from the locations in the supplied {@code WebMergedContextConfiguration} using a
* {@link GroovyBeanDefinitionReader}.
*
* @param context the context into which the bean definitions should be loaded
* @param webMergedConfig the merged context configuration
* @see AbstractGenericWebContextLoader#loadBeanDefinitions
*/
@Override
protected void loadBeanDefinitions(GenericWebApplicationContext context,
WebMergedContextConfiguration webMergedConfig) {
new GroovyBeanDefinitionReader(context).loadBeanDefinitions(webMergedConfig.getLocations());
}
示例10: loadBeanDefinitions
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader; //导入依赖的package包/类
/**
* Load bean definitions into the supplied {@link GenericApplicationContext context}
* from the locations in the supplied {@code MergedContextConfiguration} using a
* {@link GroovyBeanDefinitionReader}.
*
* @param context the context into which the bean definitions should be loaded
* @param mergedConfig the merged context configuration
* @see org.springframework.test.context.support.AbstractGenericContextLoader#loadBeanDefinitions
*/
@Override
protected void loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig) {
new GroovyBeanDefinitionReader(context).loadBeanDefinitions(mergedConfig.getLocations());
}