SimpleMetadataReaderFactory is capable of resolving inner class names with dot syntax now (analogous to ClassUtils.forName)

Issue: SPR-12390
(cherry picked from commit 2d874d7)
This commit is contained in:
Juergen Hoeller
2014-11-01 12:58:08 +01:00
parent d53b67f5cb
commit bb6349f8cc
2 changed files with 31 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
/**
* @author Chris Beams
* @author Juergen Hoeller
*/
public class ConfigurationClassPostProcessorTests {
@@ -49,6 +50,17 @@ public class ConfigurationClassPostProcessorTests {
assertSame(foo, bar.foo);
}
@Test
public void configurationIntrospectionOfInnerClassesWorksWithDotNameSyntax() {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
beanFactory.registerBeanDefinition("config", new RootBeanDefinition(getClass().getName() + ".SingletonBeanConfig"));
ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor();
pp.postProcessBeanFactory(beanFactory);
Foo foo = beanFactory.getBean("foo", Foo.class);
Bar bar = beanFactory.getBean("bar", Bar.class);
assertSame(foo, bar.foo);
}
/**
* Tests the fix for SPR-5655, a special workaround that prefers reflection
* over ASM if a bean class is already loaded.