diff --git a/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java b/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java index adc231e091e..05d8e288e99 100644 --- a/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java +++ b/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import groovy.lang.GroovyObjectSupport; import groovy.lang.GroovyShell; import groovy.lang.GroovySystem; import groovy.lang.MetaClass; + import org.codehaus.groovy.runtime.DefaultGroovyMethods; import org.codehaus.groovy.runtime.InvokerHelper; @@ -58,8 +59,17 @@ import org.springframework.util.StringUtils; /** * A Groovy-based reader for Spring bean definitions: like a Groovy builder, - * but more of a DSL for Spring configuration. Allows syntax like: + * but more of a DSL for Spring configuration. * + *
This bean definition reader also understands XML bean definition files, + * allowing for seamless mixing and matching with Groovy bean definition files. + * + *
Typically applied to a + * {@link org.springframework.beans.factory.support.DefaultListableBeanFactory} + * or a {@link org.springframework.context.support.GenericApplicationContext}, + * but can be used against any {@link BeanDefinitionRegistry} implementation. + * + *
* import org.hibernate.SessionFactory * import org.apache.commons.dbcp.BasicDataSource @@ -84,8 +94,9 @@ import org.springframework.util.StringUtils; * }* *
You can also load resources containing beans defined in a Groovy script using - * either the {@link #loadBeanDefinitions(org.springframework.core.io.Resource...)} - * or {@link #loadBeanDefinitions(String...)} method, with a script looking as follows: + * either the {@link #loadBeanDefinitions(Resource...)} or + * {@link #loadBeanDefinitions(String...)} method, with a script looking similar to + * the following. * *
* import org.hibernate.SessionFactory @@ -109,17 +120,10 @@ import org.springframework.util.StringUtils; * } * }* - *
This bean definition reader also understands XML bean definition files, - * allowing for seamless mixing and matching with Groovy bean definition files. - * - *
Typically applied to a
- * {@link org.springframework.beans.factory.support.DefaultListableBeanFactory}
- * or a {@link org.springframework.context.support.GenericApplicationContext},
- * but can be used against any {@link BeanDefinitionRegistry} implementation.
- *
* @author Jeff Brown
* @author Graeme Rocher
* @author Juergen Hoeller
+ * @author Sam Brannen
* @since 4.0
* @see BeanDefinitionRegistry
* @see org.springframework.beans.factory.support.DefaultListableBeanFactory
@@ -130,21 +134,20 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
private final XmlBeanDefinitionReader xmlBeanDefinitionReader;
+ private final Map Note that ".xml" files will be parsed as XML content; all other kinds
+ * Note that {@code ".xml"} files will be parsed as XML content; all other kinds
* of resources will be parsed as Groovy scripts.
- * @param resource the resource descriptor for the Groovy script
+ * @param resource the resource descriptor for the Groovy script or XML file
* @return the number of bean definitions found
* @throws BeanDefinitionStoreException in case of loading or parsing errors
*/
@@ -204,10 +207,10 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
/**
* Load bean definitions from the specified Groovy script or XML file.
- * Note that ".xml" files will be parsed as XML content; all other kinds
+ * Note that {@code ".xml"} files will be parsed as XML content; all other kinds
* of resources will be parsed as Groovy scripts.
- * @param encodedResource the resource descriptor for the Groovy script,
- * allowing to specify an encoding to use for parsing the file
+ * @param encodedResource the resource descriptor for the Groovy script or XML file,
+ * allowing specification of an encoding to use for parsing the file
* @return the number of bean definitions found
* @throws BeanDefinitionStoreException in case of loading or parsing errors
*/
@@ -255,14 +258,14 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
/**
* Defines a set of beans for the given block or closure.
* @param closure the block or closure
- * @return this GroovyBeanDefinitionReader instance
+ * @return this {@code GroovyBeanDefinitionReader} instance
*/
public GroovyBeanDefinitionReader beans(Closure closure) {
return invokeBeanDefiningClosure(closure);
}
/**
- * Defines an inner bean definition.
+ * Define an inner bean definition.
* @param type the bean type
* @return the bean definition
*/
@@ -307,7 +310,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
}
/**
- * Define a Spring namespace definition to use.
+ * Define a Spring XML namespace definition to use.
* @param definition the namespace definition
*/
public void xmlns(Map
*
*/
public Object getProperty(String name) {