This commit is contained in:
Stephane Nicoll 2022-07-22 12:09:16 +02:00
parent c09eb633db
commit bbcc269487
2 changed files with 34 additions and 4 deletions

View File

@ -68,10 +68,10 @@ class DefaultBeanRegistrationCodeFragmentsTests {
@Test
void getTargetOnMethod() {
RegisteredBean registeredBean = registerTestBean(SimpleBean.class);
Method method = ReflectionUtils.findMethod(SimpleBeanFactoryBean.class, "getObject");
Method method = ReflectionUtils.findMethod(SimpleBeanConfiguration.class, "simpleBean");
assertThat(method).isNotNull();
assertThat(createInstance(registeredBean).getTarget(registeredBean,
method)).isEqualTo(SimpleBeanFactoryBean.class);
method)).isEqualTo(SimpleBeanConfiguration.class);
}
@Test
@ -107,9 +107,10 @@ class DefaultBeanRegistrationCodeFragmentsTests {
RegisteredBean registeredBean = registerTestBean(DummyFactory.class);
RegisteredBean innerBean = RegisteredBean.ofInnerBean(registeredBean, "innerTestBean",
new RootBeanDefinition(SimpleBean.class));
Method method = ReflectionUtils.findMethod(SimpleBeanFactoryBean.class, "getObject");
Method method = ReflectionUtils.findMethod(SimpleBeanConfiguration.class, "simpleBean");
assertThat(method).isNotNull();
assertThat(createInstance(innerBean).getTarget(innerBean, method)).isEqualTo(SimpleBeanFactoryBean.class);
assertThat(createInstance(innerBean).getTarget(innerBean, method))
.isEqualTo(SimpleBeanConfiguration.class);
}
@Test

View File

@ -0,0 +1,29 @@
/*
* Copyright 2002-2022 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
*
* https://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.aot;
/**
*
* @author Stephane Nicoll
*/
public class SimpleBeanConfiguration {
public SimpleBean simpleBean() {
return new SimpleBean();
}
}