+ Updated all projects to use the re-introduced org.springframework.asm instead of org.objectweb.asm (.java, template.mf, ivy.xml, and .classpath files have been updated)
+ Finished support for @Import, including detection of circular imports
This commit is contained in:
parent
9182cab52f
commit
3ae3de19a9
|
@ -12,11 +12,10 @@
|
|||
<classpathentry kind="var" path="IVY_CACHE/net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3/com.springsource.net.sf.cglib-2.1.3.jar" sourcepath="/IVY_CACHE/net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3/com.springsource.net.sf.cglib-sources-2.1.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-1.2.15.jar" sourcepath="/IVY_CACHE/org.apache.log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-sources-1.2.15.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-4.5.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-sources-4.5.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-sources-2.2.3.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.beans"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.core"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.pool/1.3.0/com.springsource.org.apache.commons.pool-1.3.0.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.pool/1.3.0/com.springsource.org.apache.commons.pool-sources-1.3.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.aspectj/com.springsource.org.aspectj.weaver/1.6.2.RELEASE/com.springsource.org.aspectj.weaver-1.6.2.RELEASE.jar" sourcepath="IVY_CACHE/org.aspectj/com.springsource.org.aspectj.weaver/1.6.2.RELEASE/com.springsource.org.aspectj.weaver-sources-1.6.2.RELEASE.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.beans"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.core"/>
|
||||
<classpathentry kind="lib" path="/org.springframework.asm/target/artifacts/org.springframework.asm.jar" sourcepath="/org.springframework.asm/target/artifacts/org.springframework.asm-sources.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
<dependency org="org.apache.log4j" name="com.springsource.org.apache.log4j" rev="1.2.15" conf="test->runtime"/>
|
||||
<dependency org="org.easymock" name="com.springsource.org.easymock" rev="2.3.0" conf="test->compile"/>
|
||||
<dependency org="org.junit" name="com.springsource.org.junit" rev="4.5.0" conf="test->runtime"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm" rev="2.2.3" conf="test->runtime"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm.commons" rev="2.2.3" conf="test->runtime"/>
|
||||
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="test->runtime"/>
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
||||
|
|
|
@ -26,11 +26,6 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import org.springframework.beans.BeanMetadataAttribute;
|
||||
import org.springframework.beans.BeanMetadataAttributeAccessor;
|
||||
import org.springframework.beans.PropertyValue;
|
||||
|
@ -63,6 +58,10 @@ import org.springframework.util.ObjectUtils;
|
|||
import org.springframework.util.PatternMatchUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
/**
|
||||
* Stateful delegate class used to parse XML bean definitions.
|
||||
|
@ -374,7 +373,7 @@ public class BeanDefinitionParserDelegate {
|
|||
|
||||
String beanName = id;
|
||||
if (!StringUtils.hasText(beanName) && !aliases.isEmpty()) {
|
||||
beanName = (String) aliases.remove(0);
|
||||
beanName = aliases.remove(0);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("No XML 'id' specified - using '" + beanName +
|
||||
"' as bean name and " + aliases + " as aliases");
|
||||
|
@ -1054,7 +1053,7 @@ public class BeanDefinitionParserDelegate {
|
|||
typedValue = new TypedStringValue(value);
|
||||
}
|
||||
else if (classLoader != null) {
|
||||
Class targetType = ClassUtils.forName(targetTypeName, classLoader);
|
||||
Class<?> targetType = ClassUtils.forName(targetTypeName, classLoader);
|
||||
typedValue = new TypedStringValue(value, targetType);
|
||||
}
|
||||
else {
|
||||
|
@ -1067,7 +1066,7 @@ public class BeanDefinitionParserDelegate {
|
|||
/**
|
||||
* Parse a list element.
|
||||
*/
|
||||
public List parseListElement(Element collectionEle, BeanDefinition bd) {
|
||||
public List<?> parseListElement(Element collectionEle, BeanDefinition bd) {
|
||||
String defaultTypeClassName = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
|
||||
NodeList nl = collectionEle.getChildNodes();
|
||||
ManagedList list = new ManagedList(nl.getLength());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="var" path="CLOVER_RUNTIME"/>
|
||||
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
|
@ -7,11 +8,10 @@
|
|||
<classpathentry kind="var" path="IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-4.5.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-sources-4.5.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-sources-1.1.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3/com.springsource.net.sf.cglib-2.1.3.jar" sourcepath="/IVY_CACHE/net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3/com.springsource.net.sf.cglib-sources-2.1.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-sources-2.2.3.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.context"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.beans"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.aop"/>
|
||||
<classpathentry kind="lib" path="/org.springframework.asm/target/artifacts/org.springframework.asm.jar" sourcepath="/org.springframework.asm/target/artifacts/org.springframework.asm-sources.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -10,11 +10,21 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.cenqua.clover.core.prejavabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.cenqua.clover.core.postjavabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
|
@ -32,5 +42,6 @@
|
|||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>com.cenqua.clover.core.clovernature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
<!-- global dependencies -->
|
||||
<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.logging" rev="1.1.1" conf="compile->compile"/>
|
||||
<dependency org="org.apache.log4j" name="com.springsource.org.apache.log4j" rev="1.2.15" conf="compile->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm" rev="2.2.3" conf="compile->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm.commons" rev="2.2.3" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.beans" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.context" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.aop" rev="latest.integration" conf="compile->compile"/>
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Annotation that allows one {@link Configuration} class to import another Configuration,
|
||||
* and thereby all its {@link Bean} definitions.
|
||||
*
|
||||
* <p>Provides functionality equivalent to the {@literal <import/>} element in Spring XML.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @since 3.0
|
||||
* @see Configuration
|
||||
*/
|
||||
@Target({ ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
public @interface Import {
|
||||
|
||||
/**
|
||||
* The {@link Configuration} class or classes to import.
|
||||
*/
|
||||
Class<?>[] value();
|
||||
}
|
|
@ -17,11 +17,11 @@ package org.springframework.config.java.support;
|
|||
|
||||
import net.sf.cglib.asm.Constants;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.ClassAdapter;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.FieldVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.ClassAdapter;
|
||||
import org.springframework.asm.ClassVisitor;
|
||||
import org.springframework.asm.FieldVisitor;
|
||||
import org.springframework.asm.MethodVisitor;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
|
||||
|
||||
/**
|
||||
* An empty AnnotationVisitor that delegates to another AnnotationVisitor. This class can be
|
||||
* used as a super class to quickly implement useful annotation adapter classes, just by
|
||||
* overriding the necessary methods. Note that for some reason, ASM doesn't provide this
|
||||
* class (it does provide MethodAdapter and ClassAdapter), thus we're following the general
|
||||
* pattern and adding our own here.
|
||||
* An empty {@link AnnotationVisitor} that delegates to another AnnotationVisitor. This
|
||||
* class can be used as a super class to quickly implement useful annotation adapter
|
||||
* classes, just by overriding the necessary methods. Note that for some reason, ASM
|
||||
* doesn't provide this class (it does provide MethodAdapter and ClassAdapter), thus
|
||||
* we're following the general pattern and adding our own here.
|
||||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
|
|
|
@ -20,8 +20,8 @@ import java.io.InputStream;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.commons.EmptyVisitor;
|
||||
import org.springframework.asm.ClassReader;
|
||||
import org.springframework.asm.commons.EmptyVisitor;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import static java.lang.String.*;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
|
||||
/**
|
||||
* Thrown by {@link ConfigurationParser} upon detecting circular use of the {@link Import} annotation.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @see Import
|
||||
* @see ImportStack
|
||||
* @see ImportStackHolder
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class CircularImportException extends IllegalStateException {
|
||||
public CircularImportException(ConfigurationClass attemptedImport, Stack<ConfigurationClass> currentImportStack) {
|
||||
super(format("A circular @Import has been detected: " +
|
||||
"Illegal attempt by @Configuration class '%s' to import class '%s' as '%s' is " +
|
||||
"already present in the current import stack [%s]",
|
||||
currentImportStack.peek().getSimpleName(), attemptedImport.getSimpleName(),
|
||||
attemptedImport.getSimpleName(), currentImportStack));
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ import java.util.Set;
|
|||
import org.springframework.beans.factory.parsing.Location;
|
||||
import org.springframework.beans.factory.parsing.Problem;
|
||||
import org.springframework.beans.factory.parsing.ProblemReporter;
|
||||
import org.springframework.config.java.Bean;
|
||||
import org.springframework.config.java.Configuration;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.util.Assert;
|
||||
|
@ -34,17 +35,10 @@ import sun.security.x509.Extension;
|
|||
|
||||
/**
|
||||
* Abstract representation of a user-defined {@link Configuration @Configuration} class.
|
||||
* Includes a set of Bean methods, AutoBean methods, ExternalBean methods, ExternalValue
|
||||
* methods, etc. Includes all such methods defined in the ancestry of the class, in a
|
||||
* 'flattened-out' manner. Note that each BeanMethod representation does still contain
|
||||
* source information about where it was originally detected (for the purpose of tooling
|
||||
* with Spring IDE).
|
||||
*
|
||||
* <p>
|
||||
* Like the rest of the {@link org.springframework.config.java.model model} package, this
|
||||
* class follows the fluent interface / builder pattern such that a model can be built up
|
||||
* easily by method chaining.
|
||||
* </p>
|
||||
* Includes a set of {@link Bean} methods, including all such methods defined in the
|
||||
* ancestry of the class, in a 'flattened-out' manner. Note that each {@link BeanMethod}
|
||||
* representation contains source information about where it was originally detected
|
||||
* (for the purpose of tooling with Spring IDE).
|
||||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
|
@ -178,11 +172,11 @@ final class ConfigurationClass extends ModelClass {
|
|||
|
||||
// configuration classes must be annotated with @Configuration
|
||||
if (metadata == null)
|
||||
problemReporter.error(new NonAnnotatedConfigurationError());
|
||||
problemReporter.error(new NonAnnotatedConfigurationProblem());
|
||||
|
||||
// a configuration class may not be final (CGLIB limitation)
|
||||
if (Modifier.isFinal(modifiers))
|
||||
problemReporter.error(new FinalConfigurationError());
|
||||
problemReporter.error(new FinalConfigurationProblem());
|
||||
|
||||
for (BeanMethod method : methods)
|
||||
method.validate(problemReporter);
|
||||
|
@ -247,11 +241,12 @@ final class ConfigurationClass extends ModelClass {
|
|||
|
||||
|
||||
/** Configuration classes must be annotated with {@link Configuration @Configuration}. */
|
||||
public class NonAnnotatedConfigurationError extends Problem {
|
||||
public NonAnnotatedConfigurationError() {
|
||||
super(format("%s was provided as a Java Configuration class but was not annotated with @%s. "
|
||||
+ "Update the class definition to continue.",
|
||||
getSimpleName(), Configuration.class.getSimpleName()),
|
||||
public class NonAnnotatedConfigurationProblem extends Problem {
|
||||
|
||||
public NonAnnotatedConfigurationProblem() {
|
||||
super(format("%s was specified as a @Configuration class but was not actually annotated " +
|
||||
"with @Configuration. Annotate the class or do not attempt to process it.",
|
||||
getSimpleName()),
|
||||
new Location(new FileSystemResource("/dev/null"))
|
||||
);
|
||||
}
|
||||
|
@ -260,13 +255,15 @@ final class ConfigurationClass extends ModelClass {
|
|||
|
||||
|
||||
/** Configuration classes must be non-final to accommodate CGLIB subclassing. */
|
||||
public class FinalConfigurationError extends Problem {
|
||||
public FinalConfigurationError() {
|
||||
super(format("@%s class may not be final. Remove the final modifier to continue.",
|
||||
Configuration.class.getSimpleName()),
|
||||
public class FinalConfigurationProblem extends Problem {
|
||||
|
||||
public FinalConfigurationProblem() {
|
||||
super(format("@Configuration class [%s] may not be final. Remove the final modifier to continue.",
|
||||
ConfigurationClass.this.getSimpleName()),
|
||||
new Location(new FileSystemResource("/dev/null"))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,11 +23,11 @@ import static org.springframework.util.ClassUtils.*;
|
|||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.ClassAdapter;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodAdapter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.ClassAdapter;
|
||||
import org.springframework.asm.Label;
|
||||
import org.springframework.asm.MethodAdapter;
|
||||
import org.springframework.asm.Opcodes;
|
||||
import org.springframework.config.java.Bean;
|
||||
import org.springframework.config.java.Configuration;
|
||||
|
||||
|
|
|
@ -22,12 +22,13 @@ import static org.springframework.util.ClassUtils.*;
|
|||
import java.lang.annotation.Annotation;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.ClassAdapter;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.ClassAdapter;
|
||||
import org.springframework.asm.ClassReader;
|
||||
import org.springframework.asm.MethodVisitor;
|
||||
import org.springframework.asm.Opcodes;
|
||||
import org.springframework.config.java.Configuration;
|
||||
import org.springframework.config.java.Import;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -112,17 +113,16 @@ class ConfigurationClassVisitor extends ClassAdapter {
|
|||
return new MutableAnnotationVisitor(mutableConfiguration, classLoader);
|
||||
}
|
||||
|
||||
// TODO: re-enable for @Import support
|
||||
// if (Import.class.getName().equals(annoTypeName)) {
|
||||
// ImportStack importStack = ImportStackHolder.getImportStack();
|
||||
//
|
||||
// if(importStack.contains(configClass))
|
||||
// throw new CircularImportException(configClass, importStack);
|
||||
//
|
||||
// importStack.push(configClass);
|
||||
//
|
||||
// return new ImportAnnotationVisitor(model);
|
||||
// }
|
||||
if (Import.class.getName().equals(annoTypeName)) {
|
||||
ImportStack importStack = ImportStackHolder.getImportStack();
|
||||
|
||||
if (importStack.contains(configClass))
|
||||
throw new CircularImportException(configClass, importStack);
|
||||
|
||||
importStack.push(configClass);
|
||||
|
||||
return new ImportAnnotationVisitor(model, classLoader);
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
// Detect @Extension annotations
|
||||
|
|
|
@ -34,9 +34,9 @@ import net.sf.cglib.proxy.MethodProxy;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.objectweb.asm.ClassAdapter;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.springframework.asm.ClassAdapter;
|
||||
import org.springframework.asm.ClassReader;
|
||||
import org.springframework.asm.ClassWriter;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.config.java.Configuration;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.springframework.asm.ClassReader;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.config.java.Configuration;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import static java.lang.String.*;
|
||||
import static org.springframework.config.java.support.AsmUtils.*;
|
||||
import static org.springframework.util.ClassUtils.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.ClassReader;
|
||||
import org.springframework.asm.Type;
|
||||
import org.springframework.config.java.Import;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* ASM {@link AnnotationVisitor} implementation that reads an {@link Import} annotation
|
||||
* for all its specified classes and then one by one processes each class with a new
|
||||
* {@link ConfigurationClassVisitor}.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @see Import
|
||||
* @see ImportStack
|
||||
* @see ImportStackHolder
|
||||
* @see ConfigurationClassVisitor
|
||||
*/
|
||||
class ImportAnnotationVisitor extends AnnotationAdapter {
|
||||
private final ArrayList<String> classesToImport = new ArrayList<String>();
|
||||
private final ConfigurationModel model;
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
public ImportAnnotationVisitor(ConfigurationModel model, ClassLoader classLoader) {
|
||||
super(AsmUtils.EMPTY_VISITOR);
|
||||
this.model = model;
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitArray(String attribName) {
|
||||
Assert.isTrue("value".equals(attribName),
|
||||
format("expected 'value' attribute, got unknown '%s' attribute", attribName));
|
||||
|
||||
return new AnnotationAdapter(AsmUtils.EMPTY_VISITOR) {
|
||||
@Override
|
||||
public void visit(String na, Object type) {
|
||||
Assert.isInstanceOf(Type.class, type);
|
||||
classesToImport.add(((Type) type).getClassName());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
for (String classToImport : classesToImport)
|
||||
processClassToImport(classToImport);
|
||||
|
||||
ImportStackHolder.getImportStack().pop();
|
||||
}
|
||||
|
||||
private void processClassToImport(String classToImport) {
|
||||
ConfigurationClass configClass = new ConfigurationClass();
|
||||
|
||||
ClassReader reader = newClassReader(convertClassNameToResourcePath(classToImport), classLoader);
|
||||
|
||||
reader.accept(new ConfigurationClassVisitor(configClass, model, classLoader), false);
|
||||
|
||||
model.add(configClass);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.springframework.config.java.Import;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* Stack used for detecting circular use of the {@link Import} annotation.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @see Import
|
||||
* @see ImportStackHolder
|
||||
* @see CircularImportException
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class ImportStack extends Stack<ConfigurationClass> {
|
||||
|
||||
/**
|
||||
* Simplified contains() implementation that tests to see if any {@link ConfigurationClass}
|
||||
* exists within this stack that has the same name as <var>elem</var>. Elem must be of
|
||||
* type ConfigurationClass.
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(Object elem) {
|
||||
Assert.isInstanceOf(ConfigurationClass.class, elem);
|
||||
|
||||
ConfigurationClass configClass = (ConfigurationClass) elem;
|
||||
|
||||
Comparator<ConfigurationClass> comparator = new Comparator<ConfigurationClass>() {
|
||||
public int compare(ConfigurationClass first, ConfigurationClass second) {
|
||||
return first.getName().equals(second.getName()) ? 0 : 1;
|
||||
}
|
||||
};
|
||||
|
||||
int index = Collections.binarySearch(this, configClass, comparator);
|
||||
|
||||
return index >= 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a stack containing (in order)
|
||||
* <ol>
|
||||
* <li>com.acme.Foo</li>
|
||||
* <li>com.acme.Bar</li>
|
||||
* <li>com.acme.Baz</li>
|
||||
* </ol>
|
||||
* Returns "Foo->Bar->Baz". In the case of an empty stack, returns empty string.
|
||||
*/
|
||||
@Override
|
||||
public synchronized String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
Iterator<ConfigurationClass> iterator = this.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
builder.append(iterator.next().getSimpleName());
|
||||
if (iterator.hasNext())
|
||||
builder.append("->");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import org.springframework.config.java.Import;
|
||||
|
||||
|
||||
/**
|
||||
* Holder class to expose a thread-bound {@link ImportStack}, used while detecting circular
|
||||
* declarations of the {@link Import} annotation.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @see Import
|
||||
* @see ImportStack
|
||||
* @see CircularImportException
|
||||
*/
|
||||
class ImportStackHolder {
|
||||
|
||||
private static ThreadLocal<ImportStack> stackHolder = new ThreadLocal<ImportStack>() {
|
||||
@Override
|
||||
protected ImportStack initialValue() {
|
||||
return new ImportStack();
|
||||
}
|
||||
};
|
||||
|
||||
public static ImportStack getImportStack() {
|
||||
return stackHolder.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Holder for circular @Import detection stack";
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@ import java.lang.annotation.Annotation;
|
|||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
|
||||
|
||||
class MutableAnnotationArrayVisitor extends AnnotationAdapter {
|
||||
|
|
|
@ -21,8 +21,8 @@ import static org.springframework.config.java.support.Util.*;
|
|||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.Type;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.config.java.Bean;
|
||||
import org.springframework.config.java.Import;
|
||||
|
||||
import test.beans.TestBean;
|
||||
|
||||
|
||||
/**
|
||||
* TCK-style unit tests for handling circular use of the {@link Import} annotation. Explore
|
||||
* subclass hierarchy for specific concrete implementations.
|
||||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public abstract class AbstractCircularImportDetectionTests {
|
||||
protected abstract ConfigurationParser newParser();
|
||||
|
||||
protected abstract String loadAsConfigurationSource(Class<?> clazz) throws Exception;
|
||||
|
||||
@Test
|
||||
public void simpleCircularImportIsDetected() throws Exception {
|
||||
boolean threw = false;
|
||||
try {
|
||||
newParser().parse(loadAsConfigurationSource(A.class), null);
|
||||
} catch (CircularImportException ex) {
|
||||
assertTrue("Wrong message. Got: " + ex.getMessage(),
|
||||
ex.getMessage().contains(
|
||||
"Illegal attempt by @Configuration class 'AbstractCircularImportDetectionTests.B' " +
|
||||
"to import class 'AbstractCircularImportDetectionTests.A'"));
|
||||
threw = true;
|
||||
}
|
||||
|
||||
assertTrue(threw);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void complexCircularImportIsDetected() throws Exception {
|
||||
boolean threw = false;
|
||||
try {
|
||||
newParser().parse(loadAsConfigurationSource(X.class), null);
|
||||
} catch (CircularImportException ex) {
|
||||
assertTrue("Wrong message. Got: " + ex.getMessage(),
|
||||
ex.getMessage().contains(
|
||||
"Illegal attempt by @Configuration class 'AbstractCircularImportDetectionTests.Z2' " +
|
||||
"to import class 'AbstractCircularImportDetectionTests.Z'"));
|
||||
threw = true;
|
||||
}
|
||||
|
||||
assertTrue(threw);
|
||||
}
|
||||
|
||||
@Import(B.class)
|
||||
static class A {
|
||||
@Bean
|
||||
TestBean b1() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Import(A.class)
|
||||
static class B {
|
||||
@Bean
|
||||
TestBean b2() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Import( { Y.class, Z.class })
|
||||
class X {
|
||||
@Bean
|
||||
TestBean x() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
class Y {
|
||||
@Bean
|
||||
TestBean y() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Import( { Z1.class, Z2.class })
|
||||
class Z {
|
||||
@Bean
|
||||
TestBean z() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
class Z1 {
|
||||
@Bean
|
||||
TestBean z1() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Import(Z.class)
|
||||
class Z2 {
|
||||
@Bean
|
||||
TestBean z2() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import org.springframework.config.java.Import;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Unit test proving that ASM-based {@link ConfigurationParser} correctly detects circular use of
|
||||
* the {@link Import @Import} annotation.
|
||||
*
|
||||
* <p>While this test is the only subclass of {@link AbstractCircularImportDetectionTests}, the
|
||||
* hierarchy remains in place in case a JDT-based ConfigurationParser implementation needs to be
|
||||
* developed.
|
||||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class AsmCircularImportDetectionTests extends AbstractCircularImportDetectionTests {
|
||||
@Override
|
||||
protected ConfigurationParser newParser() {
|
||||
return new ConfigurationParser(ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String loadAsConfigurationSource(Class<?> clazz) throws Exception {
|
||||
return clazz.getName();
|
||||
}
|
||||
|
||||
}
|
|
@ -50,9 +50,7 @@ public class ConfigurationPostProcessorTests {
|
|||
@Configuration class Config { }
|
||||
|
||||
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
|
||||
|
||||
factory.registerBeanDefinition("config1", rootBeanDefinition(Config.class).getBeanDefinition());
|
||||
|
||||
factory.registerBeanDefinition("config", rootBeanDefinition(Config.class).getBeanDefinition());
|
||||
ConfigurationClassPostProcessor cpp = new ConfigurationClassPostProcessor();
|
||||
|
||||
// temporarily set the cglib test class to something bogus
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.config.java.Configuration;
|
||||
|
||||
|
||||
/**
|
||||
* Unit tests covering cases where a user defines an invalid Configuration
|
||||
* class, e.g.: forgets to annotate with {@link Configuration} or declares
|
||||
* a Configuration class as final.
|
||||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class InvalidConfigurationClassDefinitionTests {
|
||||
|
||||
@Test
|
||||
public void configurationClassesMayNotBeFinal() {
|
||||
@Configuration
|
||||
final class Config { }
|
||||
|
||||
BeanDefinition configBeanDef = rootBeanDefinition(Config.class).getBeanDefinition();
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
beanFactory.registerBeanDefinition("config", configBeanDef);
|
||||
|
||||
try {
|
||||
new ConfigurationClassPostProcessor().postProcessBeanFactory(beanFactory);
|
||||
fail("expected exception");
|
||||
} catch (BeanDefinitionParsingException ex) {
|
||||
assertTrue(ex.getMessage(), ex.getMessage().contains("Remove the final modifier"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,275 @@
|
|||
/*
|
||||
* Copyright 2002-2008 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package test.feature.atimport;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.config.java.Bean;
|
||||
import org.springframework.config.java.Configuration;
|
||||
import org.springframework.config.java.Import;
|
||||
import org.springframework.config.java.support.ConfigurationClassPostProcessor;
|
||||
|
||||
import test.beans.ITestBean;
|
||||
import test.beans.TestBean;
|
||||
|
||||
|
||||
/**
|
||||
* System tests for {@link Import} annotation support.
|
||||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class ImportTests {
|
||||
|
||||
private DefaultListableBeanFactory processConfigurationClasses(Class<?>... classes) {
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
for (Class<?> clazz : classes)
|
||||
beanFactory.registerBeanDefinition(clazz.getSimpleName(), new RootBeanDefinition(clazz));
|
||||
new ConfigurationClassPostProcessor().postProcessBeanFactory(beanFactory);
|
||||
return beanFactory;
|
||||
}
|
||||
|
||||
private void assertBeanDefinitionCount(int expectedCount, Class<?>... classes) {
|
||||
DefaultListableBeanFactory beanFactory = processConfigurationClasses(classes);
|
||||
assertThat(beanFactory.getBeanDefinitionCount(), equalTo(expectedCount));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessImports() {
|
||||
int configClasses = 2;
|
||||
int beansInClasses = 2;
|
||||
|
||||
assertBeanDefinitionCount((configClasses + beansInClasses), ConfigurationWithImportAnnotation.class);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import(OtherConfiguration.class)
|
||||
static class ConfigurationWithImportAnnotation {
|
||||
@Bean
|
||||
public ITestBean one() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class OtherConfiguration {
|
||||
@Bean
|
||||
public ITestBean two() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@Test
|
||||
public void testImportAnnotationWithTwoLevelRecursion() {
|
||||
int configClasses = 2;
|
||||
int beansInClasses = 3;
|
||||
|
||||
assertBeanDefinitionCount((configClasses + beansInClasses), AppConfig.class);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import(DataSourceConfig.class)
|
||||
static class AppConfig {
|
||||
|
||||
@Bean
|
||||
public ITestBean transferService() {
|
||||
return new TestBean(accountRepository());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ITestBean accountRepository() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class DataSourceConfig {
|
||||
@Bean
|
||||
public ITestBean dataSourceA() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@Test
|
||||
public void testImportAnnotationWithThreeLevelRecursion() {
|
||||
int configClasses = 3;
|
||||
int beansInClasses = 5;
|
||||
|
||||
assertBeanDefinitionCount((configClasses + beansInClasses), FirstLevel.class);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@Test
|
||||
public void testImportAnnotationWithMultipleArguments() {
|
||||
int configClasses = 3;
|
||||
int beansInClasses = 3;
|
||||
|
||||
assertBeanDefinitionCount((configClasses + beansInClasses),
|
||||
WithMultipleArgumentsToImportAnnotation.class);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testImportAnnotationWithMultipleArgumentsResultingInOverriddenBeanDefinition() {
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
beanFactory.registerBeanDefinition("config", new RootBeanDefinition(
|
||||
WithMultipleArgumentsThatWillCauseDuplication.class));
|
||||
new ConfigurationClassPostProcessor().postProcessBeanFactory(beanFactory);
|
||||
assertThat(beanFactory.getBeanDefinitionCount(), equalTo(4));
|
||||
assertThat(beanFactory.getBean("foo", ITestBean.class).getName(), equalTo("foo2"));
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import( { Foo1.class, Foo2.class })
|
||||
static class WithMultipleArgumentsThatWillCauseDuplication {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class Foo1 {
|
||||
@Bean
|
||||
public ITestBean foo() {
|
||||
return new TestBean("foo1");
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class Foo2 {
|
||||
@Bean
|
||||
public ITestBean foo() {
|
||||
return new TestBean("foo2");
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@Test
|
||||
public void testImportAnnotationOnInnerClasses() {
|
||||
int configClasses = 2;
|
||||
int beansInClasses = 2;
|
||||
|
||||
assertBeanDefinitionCount((configClasses + beansInClasses), OuterConfig.InnerConfig.class);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class OuterConfig {
|
||||
@Bean
|
||||
String whatev() {
|
||||
return "whatev";
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import(ExternalConfig.class)
|
||||
static class InnerConfig {
|
||||
@Bean
|
||||
public ITestBean innerBean() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class ExternalConfig {
|
||||
@Bean
|
||||
public ITestBean extBean() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@Configuration
|
||||
@Import(SecondLevel.class)
|
||||
static class FirstLevel {
|
||||
@Bean
|
||||
public TestBean m() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import(ThirdLevel.class)
|
||||
static class SecondLevel {
|
||||
@Bean
|
||||
public TestBean n() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class ThirdLevel {
|
||||
@Bean
|
||||
public ITestBean thirdLevelA() {
|
||||
return new TestBean();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ITestBean thirdLevelB() {
|
||||
return new TestBean();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ITestBean thirdLevelC() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import( { LeftConfig.class, RightConfig.class })
|
||||
static class WithMultipleArgumentsToImportAnnotation {
|
||||
@Bean
|
||||
public TestBean m() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class LeftConfig {
|
||||
@Bean
|
||||
public ITestBean left() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class RightConfig {
|
||||
@Bean
|
||||
public ITestBean right() {
|
||||
return new TestBean();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@Test(expected=BeanDefinitionParsingException.class)
|
||||
public void testImportNonConfigurationAnnotationClassCausesError() {
|
||||
processConfigurationClasses(ConfigAnnotated.class);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import(NonConfigAnnotated.class)
|
||||
static class ConfigAnnotated { }
|
||||
|
||||
static class NonConfigAnnotated { }
|
||||
}
|
|
@ -6,8 +6,7 @@ Import-Template:
|
|||
org.springframework.core.*;version="[2.5.6, 3.0.0]",
|
||||
org.springframework.beans.*;version="[2.5.6, 3.0.0]",
|
||||
org.springframework.context.*;version="[2.5.6, 3.0.0]",
|
||||
org.objectweb.asm.*;version="[2.2.3, 3.0.0)",
|
||||
org.objectweb.asm.commons;version="[2.2.3, 3.0.0)",
|
||||
org.springframework.asm.*;version="[2.5.6, 3.0.0]",
|
||||
org.springframework.aop.*;version="[2.5.6, 3.0.0]";resolution:=optional,
|
||||
org.springframework.stereotype.*;version="[2.5.6, 3.0.0]";resolution:=optional,
|
||||
org.springframework.util.*;version="[2.5.6, 3.0.0]";resolution:=optional,
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
<classpathentry kind="var" path="IVY_CACHE/org.jruby/com.springsource.org.jruby/1.1.0/com.springsource.org.jruby-1.1.0.jar" sourcepath="/IVY_CACHE/org.jruby/com.springsource.org.jruby/1.1.0/com.springsource.org.jruby-sources-1.1.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.codehaus.groovy/com.springsource.org.codehaus.groovy/1.5.1/com.springsource.org.codehaus.groovy-1.5.1.jar" sourcepath="/IVY_CACHE/org.codehaus.groovy/com.springsource.org.codehaus.groovy/1.5.1/com.springsource.org.codehaus.groovy-sources-1.5.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.beanshell/com.springsource.bsh/2.0.0.b4/com.springsource.bsh-2.0.0.b4.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/com.sun.enterprise/com.springsource.com.sun.enterprise.loader/1.0.0/com.springsource.com.sun.enterprise.loader-1.0.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/com.oracle.oc4j/com.springsource.oracle.classloader/10.1.3.1/com.springsource.oracle.classloader-10.1.3.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.ejb/com.springsource.javax.ejb/3.0.0/com.springsource.javax.ejb-3.0.0.jar" sourcepath="/IVY_CACHE/javax.ejb/com.springsource.javax.ejb/3.0.0/com.springsource.javax.ejb-sources-3.0.0.jar"/>
|
||||
|
@ -34,5 +32,6 @@
|
|||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.dbcp/1.2.2.osgi/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.dbcp/1.2.2.osgi/com.springsource.org.apache.commons.dbcp-sources-1.2.2.osgi.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.expression"/>
|
||||
<classpathentry kind="lib" path="/org.springframework.asm/target/artifacts/org.springframework.asm.jar" sourcepath="/org.springframework.asm/target/artifacts/org.springframework.asm-sources.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -59,8 +59,7 @@
|
|||
<dependency org="org.apache.log4j" name="com.springsource.org.apache.log4j" rev="1.2.15" conf="test->runtime"/>
|
||||
<dependency org="org.junit" name="com.springsource.org.junit" rev="4.5.0" conf="test->runtime"/>
|
||||
<dependency org="org.easymock" name="com.springsource.org.easymock" rev="2.3.0" conf="test->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm" rev="2.2.3" conf="test->runtime"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm.commons" rev="2.2.3" conf="test->runtime"/>
|
||||
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="test->compile"/>
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
||||
|
|
|
@ -63,7 +63,7 @@ import org.springframework.util.SystemPropertyUtils;
|
|||
*
|
||||
* <p>This implementation is based on Spring's
|
||||
* {@link org.springframework.core.type.classreading.MetadataReader MetadataReader}
|
||||
* facility, backed by an ASM {@link org.objectweb.asm.ClassReader ClassReader}.
|
||||
* facility, backed by an ASM {@link org.springframework.asm.ClassReader ClassReader}.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Juergen Hoeller
|
||||
|
|
|
@ -8,13 +8,12 @@
|
|||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-sources-1.1.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-1.2.15.jar" sourcepath="/IVY_CACHE/org.apache.log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-sources-1.2.15.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.collections/3.2.0/com.springsource.org.apache.commons.collections-3.2.0.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.collections/3.2.0/com.springsource.org.apache.commons.collections-sources-3.2.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-4.5.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-sources-4.5.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.aspectj/com.springsource.org.aspectj.weaver/1.6.2.RELEASE/com.springsource.org.aspectj.weaver-1.6.2.RELEASE.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-2.5.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-sources-2.5.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit/1.2.0/com.springsource.org.custommonkey.xmlunit-1.2.0.jar" sourcepath="/IVY_CACHE/org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit/1.2.0/com.springsource.org.custommonkey.xmlunit-sources-1.2.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.codehaus.woodstox/com.springsource.com.ctc.wstx/3.2.7/com.springsource.com.ctc.wstx-3.2.7.jar" sourcepath="/IVY_CACHE/org.codehaus.woodstox/com.springsource.com.ctc.wstx/3.2.7/com.springsource.com.ctc.wstx-sources-3.2.7.jar"/>
|
||||
<classpathentry kind="lib" path="/org.springframework.asm/target/artifacts/org.springframework.asm.jar" sourcepath="/org.springframework.asm/target/artifacts/org.springframework.asm-sources.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -30,18 +30,15 @@
|
|||
conf="optional, log4j->compile"/>
|
||||
<dependency org="org.aspectj" name="com.springsource.org.aspectj.weaver" rev="1.6.2.RELEASE"
|
||||
conf="optional, aspectj->compile"/>
|
||||
<!-- These should be replaced with the internal repackaging of ASM -->
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm" rev="2.2.3"
|
||||
conf="optional->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm.commons" rev="2.2.3"
|
||||
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration"
|
||||
conf="optional->compile"/>
|
||||
<!-- test dependencies -->
|
||||
<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="2.5.0" conf="test->compile"/>
|
||||
<dependency org="org.junit" name="com.springsource.org.junit" rev="4.5.0" conf="test->runtime"/>
|
||||
<dependency org="org.easymock" name="com.springsource.org.easymock" rev="2.3.0" conf="test->compile"/>
|
||||
<dependency org="org.custommonkey.xmlunit" name="com.springsource.org.custommonkey.xmlunit" rev="1.2.0"
|
||||
<dependency org="org.easymock" name="com.springsource.org.easymock" rev="2.3.0" conf="test->compile"/>
|
||||
<dependency org="org.custommonkey.xmlunit" name="com.springsource.org.custommonkey.xmlunit" rev="1.2.0"
|
||||
conf="test->compile"/>
|
||||
<dependency org="org.codehaus.woodstox" name="com.springsource.com.ctc.wstx" rev="3.2.7" conf="test->compile"/>
|
||||
<dependency org="org.codehaus.woodstox" name="com.springsource.com.ctc.wstx" rev="3.2.7" conf="test->compile"/>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
|
@ -29,13 +29,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.commons.EmptyVisitor;
|
||||
|
||||
import org.springframework.asm.ClassReader;
|
||||
import org.springframework.asm.Label;
|
||||
import org.springframework.asm.MethodVisitor;
|
||||
import org.springframework.asm.Opcodes;
|
||||
import org.springframework.asm.Type;
|
||||
import org.springframework.asm.commons.EmptyVisitor;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
|
|
@ -137,7 +137,7 @@ public abstract class AnnotationUtils {
|
|||
return annotation;
|
||||
}
|
||||
}
|
||||
Class superClass = clazz.getSuperclass();
|
||||
Class<?> superClass = clazz.getSuperclass();
|
||||
if (superClass == null || superClass == Object.class) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -26,14 +26,13 @@ import java.util.LinkedHashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.commons.EmptyVisitor;
|
||||
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.MethodVisitor;
|
||||
import org.springframework.asm.Type;
|
||||
import org.springframework.asm.commons.EmptyVisitor;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.core.type.MethodMetadata;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* ASM class visitor which looks for the class name and implemented types as
|
||||
|
@ -49,9 +48,9 @@ class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor imple
|
|||
private final Map<String, Map<String, Object>> attributesMap = new LinkedHashMap<String, Map<String, Object>>();
|
||||
|
||||
private final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<String, Set<String>>();
|
||||
|
||||
|
||||
private final Set<MethodMetadata> methodMetadataSet = new LinkedHashSet<MethodMetadata>();
|
||||
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
|
||||
|
@ -59,7 +58,7 @@ class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor imple
|
|||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc,
|
||||
|
@ -75,7 +74,6 @@ class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor imple
|
|||
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
|
||||
final String className = Type.getType(desc).getClassName();
|
||||
final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
final Map<String, Object> metaAttributes = new LinkedHashMap<String, Object>();
|
||||
return new EmptyVisitor() {
|
||||
@Override
|
||||
public void visit(String name, Object value) {
|
||||
|
@ -95,7 +93,7 @@ class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor imple
|
|||
public void visitEnum(String name, String desc, String value) {
|
||||
Object valueToUse = value;
|
||||
try {
|
||||
Class enumType = classLoader.loadClass(Type.getType(desc).getClassName());
|
||||
Class<?> enumType = classLoader.loadClass(Type.getType(desc).getClassName());
|
||||
Field enumConstant = ReflectionUtils.findField(enumType, value);
|
||||
if (enumConstant != null) {
|
||||
valueToUse = enumConstant.get(null);
|
||||
|
@ -109,7 +107,7 @@ class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor imple
|
|||
@Override
|
||||
public void visitEnd() {
|
||||
try {
|
||||
Class annotationClass = classLoader.loadClass(className);
|
||||
Class<?> annotationClass = classLoader.loadClass(className);
|
||||
// Check declared default values of attributes in the annotation type.
|
||||
Method[] annotationAttributes = annotationClass.getMethods();
|
||||
for (Method annotationAttribute : annotationAttributes) {
|
||||
|
@ -123,7 +121,7 @@ class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor imple
|
|||
Annotation[] metaAnnotations = annotationClass.getAnnotations();
|
||||
Set<String> metaAnnotationTypeNames = new HashSet<String>();
|
||||
for (Annotation metaAnnotation : metaAnnotations) {
|
||||
metaAnnotationTypeNames.add(metaAnnotation.annotationType().getName());
|
||||
metaAnnotationTypeNames.add(metaAnnotation.annotationType().getName());
|
||||
}
|
||||
metaAnnotationMap.put(className, metaAnnotationTypeNames);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.springframework.core.io.ResourceLoader;
|
|||
|
||||
/**
|
||||
* Caching implementation of the {@link MetadataReaderFactory} interface,
|
||||
* caching an ASM {@link org.objectweb.asm.ClassReader} per Spring Resource handle
|
||||
* caching an ASM {@link org.springframework.asm.ClassReader} per Spring Resource handle
|
||||
* (i.e. per ".class" file).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
|
@ -16,10 +16,9 @@
|
|||
|
||||
package org.springframework.core.type.classreading;
|
||||
|
||||
import org.objectweb.asm.ClassAdapter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.commons.EmptyVisitor;
|
||||
|
||||
import org.springframework.asm.ClassAdapter;
|
||||
import org.springframework.asm.Opcodes;
|
||||
import org.springframework.asm.commons.EmptyVisitor;
|
||||
import org.springframework.core.type.ClassMetadata;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.springframework.core.type.ClassMetadata;
|
|||
|
||||
/**
|
||||
* Simple facade for accessing class metadata,
|
||||
* as read by an ASM {@link org.objectweb.asm.ClassReader}.
|
||||
* as read by an ASM {@link org.springframework.asm.ClassReader}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5
|
||||
|
|
|
@ -1,139 +1,154 @@
|
|||
package org.springframework.core.type.classreading;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.MethodAdapter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.commons.EmptyVisitor;
|
||||
import org.springframework.core.type.MethodMetadata;
|
||||
|
||||
public class MethodMetadataReadingVisitor extends MethodAdapter implements MethodMetadata {
|
||||
|
||||
private final Map<String, Map<String, Object>> attributesMap = new LinkedHashMap<String, Map<String, Object>>();
|
||||
|
||||
private final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<String, Set<String>>();
|
||||
|
||||
private ClassLoader classLoader;
|
||||
private String name;
|
||||
private int access;
|
||||
private boolean isStatic;
|
||||
|
||||
public MethodMetadataReadingVisitor(ClassLoader classLoader, String name, int access) {
|
||||
super(new EmptyVisitor());
|
||||
this.classLoader = classLoader;
|
||||
this.name = name;
|
||||
this.access = access;
|
||||
this.isStatic = ((access & Opcodes.ACC_STATIC) != 0);
|
||||
}
|
||||
|
||||
public Map<String, Object> getAnnotationAttributes(String annotationType) {
|
||||
return this.attributesMap.get(annotationType);
|
||||
}
|
||||
|
||||
public Set<String> getAnnotationTypes() {
|
||||
return this.attributesMap.keySet();
|
||||
}
|
||||
|
||||
public String getMethodName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getModifiers() {
|
||||
return access;
|
||||
}
|
||||
|
||||
public boolean hasAnnotation(String annotationType) {
|
||||
return this.attributesMap.containsKey(annotationType);
|
||||
}
|
||||
|
||||
public Set<String> getMetaAnnotationTypes(String annotationType) {
|
||||
return this.metaAnnotationMap.get(annotationType);
|
||||
}
|
||||
|
||||
public boolean hasMetaAnnotation(String metaAnnotationType) {
|
||||
Collection<Set<String>> allMetaTypes = this.metaAnnotationMap.values();
|
||||
for (Set<String> metaTypes : allMetaTypes) {
|
||||
if (metaTypes.contains(metaAnnotationType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
return isStatic;
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getAnnotationTypesWithMetaAnnotation(String metaAnnotationType) {
|
||||
|
||||
///metaAnnotationMap.put(className, metaAnnotationTypeNames);
|
||||
Set<String> annotationTypes = new LinkedHashSet<String>();
|
||||
Set< Map.Entry<String, Set<String>> > metaValues = metaAnnotationMap.entrySet();
|
||||
Iterator<Map.Entry<String, Set<String>> > metaIterator = metaValues.iterator();
|
||||
while (metaIterator.hasNext())
|
||||
{
|
||||
Map.Entry<String, Set<String>> entry = metaIterator.next();
|
||||
String attributeType = entry.getKey();
|
||||
Set<String> metaAttributes = entry.getValue();
|
||||
if (metaAttributes.contains(metaAnnotationType))
|
||||
{
|
||||
annotationTypes.add(attributeType);
|
||||
}
|
||||
}
|
||||
return annotationTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
|
||||
final String className = Type.getType(desc).getClassName();
|
||||
final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
return new EmptyVisitor() {
|
||||
@Override
|
||||
public void visit(String name, Object value) {
|
||||
// Explicitly defined annotation attribute value.
|
||||
attributes.put(name, value);
|
||||
}
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
try {
|
||||
Class annotationClass = classLoader.loadClass(className);
|
||||
// Check declared default values of attributes in the annotation type.
|
||||
Method[] annotationAttributes = annotationClass.getMethods();
|
||||
for (int i = 0; i < annotationAttributes.length; i++) {
|
||||
Method annotationAttribute = annotationAttributes[i];
|
||||
String attributeName = annotationAttribute.getName();
|
||||
Object defaultValue = annotationAttribute.getDefaultValue();
|
||||
if (defaultValue != null && !attributes.containsKey(attributeName)) {
|
||||
attributes.put(attributeName, defaultValue);
|
||||
}
|
||||
}
|
||||
// Register annotations that the annotation type is annotated with.
|
||||
Annotation[] metaAnnotations = annotationClass.getAnnotations();
|
||||
Set<String> metaAnnotationTypeNames = new HashSet<String>();
|
||||
for (Annotation metaAnnotation : metaAnnotations) {
|
||||
metaAnnotationTypeNames.add(metaAnnotation.annotationType().getName());
|
||||
}
|
||||
metaAnnotationMap.put(className, metaAnnotationTypeNames);
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
// Class not found
|
||||
}
|
||||
attributesMap.put(className, attributes);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.core.type.classreading;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.asm.AnnotationVisitor;
|
||||
import org.springframework.asm.MethodAdapter;
|
||||
import org.springframework.asm.Opcodes;
|
||||
import org.springframework.asm.Type;
|
||||
import org.springframework.asm.commons.EmptyVisitor;
|
||||
import org.springframework.core.type.MethodMetadata;
|
||||
|
||||
public class MethodMetadataReadingVisitor extends MethodAdapter implements MethodMetadata {
|
||||
|
||||
private final Map<String, Map<String, Object>> attributesMap = new LinkedHashMap<String, Map<String, Object>>();
|
||||
|
||||
private final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<String, Set<String>>();
|
||||
|
||||
private ClassLoader classLoader;
|
||||
private String name;
|
||||
private int access;
|
||||
private boolean isStatic;
|
||||
|
||||
public MethodMetadataReadingVisitor(ClassLoader classLoader, String name, int access) {
|
||||
super(new EmptyVisitor());
|
||||
this.classLoader = classLoader;
|
||||
this.name = name;
|
||||
this.access = access;
|
||||
this.isStatic = ((access & Opcodes.ACC_STATIC) != 0);
|
||||
}
|
||||
|
||||
public Map<String, Object> getAnnotationAttributes(String annotationType) {
|
||||
return this.attributesMap.get(annotationType);
|
||||
}
|
||||
|
||||
public Set<String> getAnnotationTypes() {
|
||||
return this.attributesMap.keySet();
|
||||
}
|
||||
|
||||
public String getMethodName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getModifiers() {
|
||||
return access;
|
||||
}
|
||||
|
||||
public boolean hasAnnotation(String annotationType) {
|
||||
return this.attributesMap.containsKey(annotationType);
|
||||
}
|
||||
|
||||
public Set<String> getMetaAnnotationTypes(String annotationType) {
|
||||
return this.metaAnnotationMap.get(annotationType);
|
||||
}
|
||||
|
||||
public boolean hasMetaAnnotation(String metaAnnotationType) {
|
||||
Collection<Set<String>> allMetaTypes = this.metaAnnotationMap.values();
|
||||
for (Set<String> metaTypes : allMetaTypes) {
|
||||
if (metaTypes.contains(metaAnnotationType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
return isStatic;
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getAnnotationTypesWithMetaAnnotation(String metaAnnotationType) {
|
||||
|
||||
///metaAnnotationMap.put(className, metaAnnotationTypeNames);
|
||||
Set<String> annotationTypes = new LinkedHashSet<String>();
|
||||
Set< Map.Entry<String, Set<String>> > metaValues = metaAnnotationMap.entrySet();
|
||||
Iterator<Map.Entry<String, Set<String>> > metaIterator = metaValues.iterator();
|
||||
while (metaIterator.hasNext())
|
||||
{
|
||||
Map.Entry<String, Set<String>> entry = metaIterator.next();
|
||||
String attributeType = entry.getKey();
|
||||
Set<String> metaAttributes = entry.getValue();
|
||||
if (metaAttributes.contains(metaAnnotationType))
|
||||
{
|
||||
annotationTypes.add(attributeType);
|
||||
}
|
||||
}
|
||||
return annotationTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
|
||||
final String className = Type.getType(desc).getClassName();
|
||||
final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
return new EmptyVisitor() {
|
||||
@Override
|
||||
public void visit(String name, Object value) {
|
||||
// Explicitly defined annotation attribute value.
|
||||
attributes.put(name, value);
|
||||
}
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
try {
|
||||
Class<?> annotationClass = classLoader.loadClass(className);
|
||||
// Check declared default values of attributes in the annotation type.
|
||||
Method[] annotationAttributes = annotationClass.getMethods();
|
||||
for (int i = 0; i < annotationAttributes.length; i++) {
|
||||
Method annotationAttribute = annotationAttributes[i];
|
||||
String attributeName = annotationAttribute.getName();
|
||||
Object defaultValue = annotationAttribute.getDefaultValue();
|
||||
if (defaultValue != null && !attributes.containsKey(attributeName)) {
|
||||
attributes.put(attributeName, defaultValue);
|
||||
}
|
||||
}
|
||||
// Register annotations that the annotation type is annotated with.
|
||||
Annotation[] metaAnnotations = annotationClass.getAnnotations();
|
||||
Set<String> metaAnnotationTypeNames = new HashSet<String>();
|
||||
for (Annotation metaAnnotation : metaAnnotations) {
|
||||
metaAnnotationTypeNames.add(metaAnnotation.annotationType().getName());
|
||||
}
|
||||
metaAnnotationMap.put(className, metaAnnotationTypeNames);
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
// Class not found
|
||||
}
|
||||
attributesMap.put(className, attributes);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
|
@ -16,14 +16,13 @@
|
|||
|
||||
package org.springframework.core.type.classreading;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
|
||||
import org.springframework.asm.ClassReader;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.core.type.ClassMetadata;
|
||||
|
||||
/**
|
||||
* {@link MetadataReader} implementation based on an ASM
|
||||
* {@link org.objectweb.asm.ClassReader}.
|
||||
* {@link org.springframework.asm.ClassReader}.
|
||||
*
|
||||
* <p>Package-visible in order to allow for repackaging the ASM library
|
||||
* without effect on users of the <code>core.type</code> package.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
|
@ -19,8 +19,7 @@ package org.springframework.core.type.classreading;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
|
||||
import org.springframework.asm.ClassReader;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
|
@ -28,7 +27,7 @@ import org.springframework.util.ClassUtils;
|
|||
|
||||
/**
|
||||
* Simple implementation of the {@link MetadataReaderFactory} interface,
|
||||
* creating a new ASM {@link org.objectweb.asm.ClassReader} for every request.
|
||||
* creating a new ASM {@link org.springframework.asm.ClassReader} for every request.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Core support package for type introspection through ASM-based class reading.
|
||||
*/
|
||||
package org.springframework.core.type.classreading;
|
|
@ -1,7 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
|
||||
Core support package for type introspection through ASM-based class reading.
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -8,7 +8,7 @@ Import-Template:
|
|||
edu.emory.mathcs.backport.*;version="[3.0.0, 4.0.0)";resolution:=optional,
|
||||
org.apache.commons.collections.*;version="[3.2.0, 4.0.0)";resolution:=optional,
|
||||
org.apache.commons.logging.*;version="[1.1.1, 2.0.0)",
|
||||
org.objectweb.asm.*;version="[2.2.3, 3.0.0)";resolution:=optional,
|
||||
org.springframework.asm.*;version="[2.5.6, 3.0.0]";resolution:=optional,
|
||||
org.apache.log4j.*;version="[1.2.15, 2.0.0)";resolution:=optional,
|
||||
org.aspectj.*;version="[1.5.4, 2.0.0)";resolution:=optional
|
||||
Unversioned-Imports:
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.web"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.web.portlet"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.web.servlet"/>
|
||||
<classpathentry kind="lib" path="/org.springframework.asm/target/artifacts/org.springframework.asm.jar" sourcepath="/org.springframework.asm/target/artifacts/org.springframework.asm-sources.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-4.5.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-sources-4.5.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-1.2.15.jar" sourcepath="/IVY_CACHE/org.apache.log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-sources-1.2.15.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/com.ibm.websphere/com.springsource.com.ibm.websphere.uow/6.0.2.17/com.springsource.com.ibm.websphere.uow-6.0.2.17.jar"/>
|
||||
|
@ -51,8 +52,6 @@
|
|||
<classpathentry kind="var" path="IVY_CACHE/org.codehaus.groovy/com.springsource.org.codehaus.groovy/1.5.1/com.springsource.org.codehaus.groovy-1.5.1.jar" sourcepath="/IVY_CACHE/org.codehaus.groovy/com.springsource.org.codehaus.groovy/1.5.1/com.springsource.org.codehaus.groovy-sources-1.5.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.freemarker/com.springsource.freemarker/2.3.12/com.springsource.freemarker-2.3.12.jar" sourcepath="/IVY_CACHE/org.freemarker/com.springsource.freemarker/2.3.12/com.springsource.freemarker-sources-2.3.12.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.hibernate/com.springsource.org.hibernate/3.2.6.ga/com.springsource.org.hibernate-3.2.6.ga.jar" sourcepath="/IVY_CACHE/org.hibernate/com.springsource.org.hibernate/3.2.6.ga/com.springsource.org.hibernate-sources-3.2.6.ga.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.testng/com.springsource.org.testng/5.8.0/com.springsource.org.testng-5.8.0.jar" sourcepath="/IVY_CACHE/org.testng/com.springsource.org.testng/5.8.0/com.springsource.org.testng-sources-5.8.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/com.caucho/com.springsource.com.caucho/3.1.5/com.springsource.com.caucho-3.1.5.jar" sourcepath="/IVY_CACHE/com.caucho/com.springsource.com.caucho/3.1.5/com.springsource.com.caucho-sources-3.1.5.jar"/>
|
||||
|
|
|
@ -76,8 +76,7 @@
|
|||
<dependency org="org.hibernate" name="com.springsource.org.hibernate.ejb" rev="3.3.1.ga" conf="test->compile"/>
|
||||
<dependency org="org.hsqldb" name="com.springsource.org.hsqldb" rev="1.8.0.9" conf="test->compile"/>
|
||||
<dependency org="org.jruby" name="com.springsource.org.jruby" rev="1.1.0" conf="optional, runtime->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm" rev="2.2.3" conf="test->runtime" />
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm.commons" rev="2.2.3" conf="test->runtime" />
|
||||
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="test->runtime"/>
|
||||
<dependency org="org.springframework" name="org.springframework.aop" rev="latest.integration" conf="test->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.beans" rev="latest.integration" conf="test->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.context" rev="latest.integration" conf="test->compile"/>
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
<dependency org="org.apache.openjpa" name="com.springsource.org.apache.openjpa" rev="1.1.0" conf="compile->compile"/>
|
||||
<dependency org="org.apache.taglibs" name="com.springsource.org.apache.taglibs.standard" rev="1.1.2" conf="compile->runtime"/>
|
||||
<dependency org="org.aspectj" name="com.springsource.org.aspectj.weaver" rev="1.6.2.RELEASE" conf="compile->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm" rev="2.2.3" conf="compile->compile" />
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm.commons" rev="2.2.3" conf="compile->compile" />
|
||||
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.orm" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.oxm" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.web.servlet" rev="latest.integration" conf="compile->compile"/>
|
||||
|
|
|
@ -10,13 +10,12 @@
|
|||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.web"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.web.servlet"/>
|
||||
<classpathentry kind="lib" path="/org.springframework.asm/target/artifacts/org.springframework.asm.jar" sourcepath="/org.springframework.asm/target/artifacts/org.springframework.asm-sources.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.portlet/com.springsource.javax.portlet/2.0.0/com.springsource.javax.portlet-2.0.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.fileupload/1.2.0/com.springsource.org.apache.commons.fileupload-1.2.0.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.fileupload/1.2.0/com.springsource.org.apache.commons.fileupload-sources-1.2.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-sources-1.1.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-4.5.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-sources-4.5.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-sources-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp/2.1.0/com.springsource.javax.servlet.jsp-2.1.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp/2.1.0/com.springsource.javax.servlet.jsp-sources-2.1.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-2.5.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-sources-2.5.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp.jstl/1.1.2/com.springsource.javax.servlet.jsp.jstl-1.1.2.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp.jstl/1.1.2/com.springsource.javax.servlet.jsp.jstl-sources-1.1.2.jar"/>
|
||||
|
|
|
@ -32,8 +32,7 @@
|
|||
<dependency org="org.springframework" name="org.springframework.core" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.web" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.web.servlet" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm" rev="2.2.3" conf="test->runtime" />
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm.commons" rev="2.2.3" conf="test->runtime" />
|
||||
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="test->runtime"/>
|
||||
<dependency org="org.easymock" name="com.springsource.org.easymock" rev="2.3.0" conf="test->compile"/>
|
||||
<dependency org="org.junit" name="com.springsource.org.junit" rev="4.5.0" conf="test->runtime"/>
|
||||
</dependencies>
|
||||
|
|
|
@ -76,14 +76,12 @@
|
|||
<!-- test dependencies -->
|
||||
<dependency org="org.junit" name="com.springsource.org.junit" rev="4.5.0" conf="test->runtime"/>
|
||||
<dependency org="org.easymock" name="com.springsource.org.easymock" rev="2.3.0" conf="test->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm" rev="2.2.3" conf="test->compile"/>
|
||||
<dependency org="org.objectweb.asm" name="com.springsource.org.objectweb.asm.commons" rev="2.2.3"
|
||||
conf="test->compile"/>
|
||||
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="test->compile"/>
|
||||
<dependency org="org.custommonkey.xmlunit" name="com.springsource.org.custommonkey.xmlunit" rev="1.2.0"
|
||||
conf="test->compile"/>
|
||||
<dependency org="org.dom4j" name="com.springsource.org.dom4j" rev="1.6.1" conf="test->compile"/>
|
||||
<dependency org="org.jaxen" name="com.springsource.org.jaxen" rev="1.1.1" conf="test->compile"/>
|
||||
<dependency org="net.sourceforge.cglib" name="com.springsource.net.sf.cglib" rev="2.1.3" conf="test->compile"/>
|
||||
<dependency org="org.jaxen" name="com.springsource.org.jaxen" rev="1.1.1" conf="test->compile"/>
|
||||
<dependency org="net.sourceforge.cglib" name="com.springsource.net.sf.cglib" rev="2.1.3" conf="test->compile"/>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
Loading…
Reference in New Issue