next cut of JavaConfig metadata reading revision: using cached MetadataReaders
This commit is contained in:
@@ -16,10 +16,7 @@
|
||||
package org.springframework.context.annotation;
|
||||
|
||||
import org.springframework.beans.factory.parsing.FailFastProblemReporter;
|
||||
import org.springframework.context.annotation.ConfigurationClassParser;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
|
||||
|
||||
/**
|
||||
* Unit test proving that ASM-based {@link ConfigurationClassParser} correctly detects circular use of
|
||||
@@ -32,9 +29,10 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class AsmCircularImportDetectionTests extends AbstractCircularImportDetectionTests {
|
||||
|
||||
@Override
|
||||
protected ConfigurationClassParser newParser() {
|
||||
return new ConfigurationClassParser(new FailFastProblemReporter(), ClassUtils.getDefaultClassLoader());
|
||||
return new ConfigurationClassParser(new CachingMetadataReaderFactory(), new FailFastProblemReporter());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.BeanAge;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.context.annotation.ScopedProxyMode;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -47,6 +46,11 @@ public final class FactoryMethodComponent {
|
||||
return new TestBean("publicInstance");
|
||||
}
|
||||
|
||||
// to be ignored
|
||||
public TestBean publicInstance(boolean doIt) {
|
||||
return new TestBean("publicInstance");
|
||||
}
|
||||
|
||||
@Bean @BeanAge(1)
|
||||
protected TestBean protectedInstance(@Qualifier("public") TestBean spouse, @Value("#{privateInstance.age}") String country) {
|
||||
TestBean tb = new TestBean("protectedInstance", 1);
|
||||
|
||||
Reference in New Issue
Block a user