Skip to content

Instantly share code, notes, and snippets.

@cbeams
Created February 3, 2012 00:46
Show Gist options
  • Select an option

  • Save cbeams/1726795 to your computer and use it in GitHub Desktop.

Select an option

Save cbeams/1726795 to your computer and use it in GitHub Desktop.
SPR-8949
/*
* Copyright 2002-2012 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.beans.factory.config;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
public class ReproTests {
@Test
public void repro() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerBeanDefinition("a", BeanDefinitionBuilder.rootBeanDefinition(A.class).addPropertyReference("b", "b").getBeanDefinition());
bf.registerBeanDefinition("b", new RootBeanDefinition(B.class));
bf.registerBeanDefinition("a.c", new RootBeanDefinition(PropertyPathFactoryBean.class));
assertThat(bf.getBean("a.c"), instanceOf(C.class));
}
}
class A {
private B b;
public void setB(B b) {
this.b = b;
}
public B getB() {
return this.b;
}
public C getC() {
return new C();
}
}
class B { }
class C { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment