This commit is contained in:
Stephane Nicoll 2022-08-03 11:03:28 +02:00
parent c9faff7491
commit dcad3beeb9
10 changed files with 17 additions and 21 deletions

View File

@ -26,7 +26,12 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.beans.factory.support.RegisteredBean;
import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.testfixture.beans.factory.DummyFactory; import org.springframework.beans.testfixture.beans.factory.DummyFactory;
import org.springframework.beans.testfixture.beans.factory.aot.GenericFactoryBean;
import org.springframework.beans.testfixture.beans.factory.aot.MockBeanRegistrationsCode; import org.springframework.beans.testfixture.beans.factory.aot.MockBeanRegistrationsCode;
import org.springframework.beans.testfixture.beans.factory.aot.NumberFactoryBean;
import org.springframework.beans.testfixture.beans.factory.aot.SimpleBean;
import org.springframework.beans.testfixture.beans.factory.aot.SimpleBeanConfiguration;
import org.springframework.beans.testfixture.beans.factory.aot.SimpleBeanFactoryBean;
import org.springframework.core.ResolvableType; import org.springframework.core.ResolvableType;
import org.springframework.core.testfixture.aot.generate.TestGenerationContext; import org.springframework.core.testfixture.aot.generate.TestGenerationContext;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;

View File

@ -19,6 +19,7 @@ package org.springframework.beans.testfixture.beans.factory.aot;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.springframework.javapoet.TypeSpec; import org.springframework.javapoet.TypeSpec;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
@ -30,6 +31,7 @@ import org.springframework.util.Assert;
*/ */
public class DeferredTypeBuilder implements Consumer<TypeSpec.Builder> { public class DeferredTypeBuilder implements Consumer<TypeSpec.Builder> {
@Nullable
private Consumer<TypeSpec.Builder> type; private Consumer<TypeSpec.Builder> type;
@Override @Override

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.beans.factory.aot; package org.springframework.beans.testfixture.beans.factory.aot;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.FactoryBean;

View File

@ -42,16 +42,13 @@ public class MockBeanFactoryInitializationCode implements BeanFactoryInitializat
public MockBeanFactoryInitializationCode(GenerationContext generationContext) { public MockBeanFactoryInitializationCode(GenerationContext generationContext) {
this.generatedClass = generationContext.getGeneratedClasses().addForFeature("TestCode", typeBuilder); this.generatedClass = generationContext.getGeneratedClasses()
.addForFeature("TestCode", this.typeBuilder);
} }
public DeferredTypeBuilder getTypeBuilder() { public DeferredTypeBuilder getTypeBuilder() {
return typeBuilder; return this.typeBuilder;
}
public GeneratedClass getGeneratedClass() {
return generatedClass;
} }
@Override @Override

View File

@ -48,11 +48,7 @@ public class MockBeanRegistrationCode implements BeanRegistrationCode {
public DeferredTypeBuilder getTypeBuilder() { public DeferredTypeBuilder getTypeBuilder() {
return typeBuilder; return this.typeBuilder;
}
public GeneratedClass getGeneratedClass() {
return this.generatedClass;
} }
@Override @Override

View File

@ -41,11 +41,7 @@ public class MockBeanRegistrationsCode implements BeanRegistrationsCode {
public DeferredTypeBuilder getTypeBuilder() { public DeferredTypeBuilder getTypeBuilder() {
return typeBuilder; return this.typeBuilder;
}
public GeneratedClass getGeneratedClass() {
return this.generatedClass;
} }
@Override @Override

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.beans.factory.aot; package org.springframework.beans.testfixture.beans.factory.aot;
/** /**
* A {@link GenericFactoryBean} that has a bound for the target type. * A {@link GenericFactoryBean} that has a bound for the target type.

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.beans.factory.aot; package org.springframework.beans.testfixture.beans.factory.aot;
/** /**
* An empty test bean used by code generation. * An empty test bean used by code generation.

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.beans.factory.aot; package org.springframework.beans.testfixture.beans.factory.aot;
/** /**
* *

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.beans.factory.aot; package org.springframework.beans.testfixture.beans.factory.aot;
import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.FactoryBean;