Merge branch '6.0.x'
This commit is contained in:
commit
abefc0aba0
|
@ -125,8 +125,8 @@ class BeanDefinitionPropertiesCodeGenerator {
|
||||||
return code.build();
|
return code.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInitDestroyMethods(Builder code,
|
private void addInitDestroyMethods(Builder code, AbstractBeanDefinition beanDefinition,
|
||||||
AbstractBeanDefinition beanDefinition, @Nullable String[] methodNames, String format) {
|
@Nullable String[] methodNames, String format) {
|
||||||
if (!ObjectUtils.isEmpty(methodNames)) {
|
if (!ObjectUtils.isEmpty(methodNames)) {
|
||||||
Class<?> beanType = ClassUtils.getUserClass(beanDefinition.getResolvableType().toClass());
|
Class<?> beanType = ClassUtils.getUserClass(beanDefinition.getResolvableType().toClass());
|
||||||
Arrays.stream(methodNames).forEach(methodName -> addInitDestroyHint(beanType, methodName));
|
Arrays.stream(methodNames).forEach(methodName -> addInitDestroyHint(beanType, methodName));
|
||||||
|
@ -144,11 +144,9 @@ class BeanDefinitionPropertiesCodeGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addConstructorArgumentValues(CodeBlock.Builder code,
|
private void addConstructorArgumentValues(CodeBlock.Builder code, BeanDefinition beanDefinition) {
|
||||||
BeanDefinition beanDefinition) {
|
Map<Integer, ValueHolder> argumentValues =
|
||||||
|
beanDefinition.getConstructorArgumentValues().getIndexedArgumentValues();
|
||||||
Map<Integer, ValueHolder> argumentValues = beanDefinition
|
|
||||||
.getConstructorArgumentValues().getIndexedArgumentValues();
|
|
||||||
if (!argumentValues.isEmpty()) {
|
if (!argumentValues.isEmpty()) {
|
||||||
argumentValues.forEach((index, valueHolder) -> {
|
argumentValues.forEach((index, valueHolder) -> {
|
||||||
CodeBlock valueCode = generateValue(valueHolder.getName(), valueHolder.getValue());
|
CodeBlock valueCode = generateValue(valueHolder.getName(), valueHolder.getValue());
|
||||||
|
@ -159,9 +157,7 @@ class BeanDefinitionPropertiesCodeGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPropertyValues(CodeBlock.Builder code,
|
private void addPropertyValues(CodeBlock.Builder code, RootBeanDefinition beanDefinition) {
|
||||||
RootBeanDefinition beanDefinition) {
|
|
||||||
|
|
||||||
MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
|
MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
|
||||||
if (!propertyValues.isEmpty()) {
|
if (!propertyValues.isEmpty()) {
|
||||||
for (PropertyValue propertyValue : propertyValues) {
|
for (PropertyValue propertyValue : propertyValues) {
|
||||||
|
@ -183,9 +179,7 @@ class BeanDefinitionPropertiesCodeGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addQualifiers(CodeBlock.Builder code,
|
private void addQualifiers(CodeBlock.Builder code, RootBeanDefinition beanDefinition) {
|
||||||
RootBeanDefinition beanDefinition) {
|
|
||||||
|
|
||||||
Set<AutowireCandidateQualifier> qualifiers = beanDefinition.getQualifiers();
|
Set<AutowireCandidateQualifier> qualifiers = beanDefinition.getQualifiers();
|
||||||
if (!qualifiers.isEmpty()) {
|
if (!qualifiers.isEmpty()) {
|
||||||
for (AutowireCandidateQualifier qualifier : qualifiers) {
|
for (AutowireCandidateQualifier qualifier : qualifiers) {
|
||||||
|
@ -244,8 +238,8 @@ class BeanDefinitionPropertiesCodeGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasScope(String defaultValue, String actualValue) {
|
private boolean hasScope(String defaultValue, String actualValue) {
|
||||||
return StringUtils.hasText(actualValue)
|
return StringUtils.hasText(actualValue) &&
|
||||||
&& !ConfigurableBeanFactory.SCOPE_SINGLETON.equals(actualValue);
|
!ConfigurableBeanFactory.SCOPE_SINGLETON.equals(actualValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasDependsOn(String[] defaultValue, String[] actualValue) {
|
private boolean hasDependsOn(String[] defaultValue, String[] actualValue) {
|
||||||
|
@ -257,16 +251,15 @@ class BeanDefinitionPropertiesCodeGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private CodeBlock toStringVarArgs(String[] strings) {
|
private CodeBlock toStringVarArgs(String[] strings) {
|
||||||
return Arrays.stream(strings).map(string -> CodeBlock.of("$S", string))
|
return Arrays.stream(strings).map(string -> CodeBlock.of("$S", string)).collect(CodeBlock.joining(","));
|
||||||
.collect(CodeBlock.joining(","));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object toRole(int value) {
|
private Object toRole(int value) {
|
||||||
return switch (value) {
|
return switch (value) {
|
||||||
case BeanDefinition.ROLE_INFRASTRUCTURE -> CodeBlock.builder()
|
case BeanDefinition.ROLE_INFRASTRUCTURE ->
|
||||||
.add("$T.ROLE_INFRASTRUCTURE", BeanDefinition.class).build();
|
CodeBlock.builder().add("$T.ROLE_INFRASTRUCTURE", BeanDefinition.class).build();
|
||||||
case BeanDefinition.ROLE_SUPPORT -> CodeBlock.builder()
|
case BeanDefinition.ROLE_SUPPORT ->
|
||||||
.add("$T.ROLE_SUPPORT", BeanDefinition.class).build();
|
CodeBlock.builder().add("$T.ROLE_SUPPORT", BeanDefinition.class).build();
|
||||||
default -> value;
|
default -> value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -276,16 +269,14 @@ class BeanDefinitionPropertiesCodeGenerator {
|
||||||
Function<B, T> getter, String format) {
|
Function<B, T> getter, String format) {
|
||||||
|
|
||||||
addStatementForValue(code, beanDefinition, getter,
|
addStatementForValue(code, beanDefinition, getter,
|
||||||
(defaultValue, actualValue) -> !Objects.equals(defaultValue, actualValue),
|
(defaultValue, actualValue) -> !Objects.equals(defaultValue, actualValue), format);
|
||||||
format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <B extends BeanDefinition, T> void addStatementForValue(
|
private <B extends BeanDefinition, T> void addStatementForValue(
|
||||||
CodeBlock.Builder code, BeanDefinition beanDefinition,
|
CodeBlock.Builder code, BeanDefinition beanDefinition,
|
||||||
Function<B, T> getter, BiPredicate<T, T> filter, String format) {
|
Function<B, T> getter, BiPredicate<T, T> filter, String format) {
|
||||||
|
|
||||||
addStatementForValue(code, beanDefinition, getter, filter, format,
|
addStatementForValue(code, beanDefinition, getter, filter, format, actualValue -> actualValue);
|
||||||
actualValue -> actualValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -297,8 +288,7 @@ class BeanDefinitionPropertiesCodeGenerator {
|
||||||
T defaultValue = getter.apply((B) DEFAULT_BEAN_DEFINITION);
|
T defaultValue = getter.apply((B) DEFAULT_BEAN_DEFINITION);
|
||||||
T actualValue = getter.apply((B) beanDefinition);
|
T actualValue = getter.apply((B) beanDefinition);
|
||||||
if (filter.test(defaultValue, actualValue)) {
|
if (filter.test(defaultValue, actualValue)) {
|
||||||
code.addStatement(format, BEAN_DEFINITION_VARIABLE,
|
code.addStatement(format, BEAN_DEFINITION_VARIABLE, formatter.apply(actualValue));
|
||||||
formatter.apply(actualValue));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
@Test
|
@Test
|
||||||
void setScopeWhenOther() {
|
void setScopeWhenOther() {
|
||||||
this.beanDefinition.setScope("prototype");
|
this.beanDefinition.setScope("prototype");
|
||||||
compile((actual, compiled) -> assertThat(actual.getScope())
|
compile((actual, compiled) -> assertThat(actual.getScope()).isEqualTo("prototype"));
|
||||||
.isEqualTo("prototype"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -120,8 +119,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
@Test
|
@Test
|
||||||
void setDependsOnWhenNotEmpty() {
|
void setDependsOnWhenNotEmpty() {
|
||||||
this.beanDefinition.setDependsOn("a", "b", "c");
|
this.beanDefinition.setDependsOn("a", "b", "c");
|
||||||
compile((actual, compiled) -> assertThat(actual.getDependsOn())
|
compile((actual, compiled) -> assertThat(actual.getDependsOn()).containsExactly("a", "b", "c"));
|
||||||
.containsExactly("a", "b", "c"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -154,8 +152,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
@Test
|
@Test
|
||||||
void setAutowireCandidateWhenFalse() {
|
void setAutowireCandidateWhenFalse() {
|
||||||
this.beanDefinition.setAutowireCandidate(false);
|
this.beanDefinition.setAutowireCandidate(false);
|
||||||
compile(
|
compile((actual, compiled) -> assertThat(actual.isAutowireCandidate()).isFalse());
|
||||||
(actual, compiled) -> assertThat(actual.isAutowireCandidate()).isFalse());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -179,8 +176,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
@Test
|
@Test
|
||||||
void setSyntheticWhenTrue() {
|
void setSyntheticWhenTrue() {
|
||||||
this.beanDefinition.setSynthetic(true);
|
this.beanDefinition.setSynthetic(true);
|
||||||
compile(
|
compile((actual, compiled) -> assertThat(actual.isSynthetic()).isTrue());
|
||||||
(actual, compiled) -> assertThat(actual.isSynthetic()).isTrue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -196,8 +192,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
void setRoleWhenInfrastructure() {
|
void setRoleWhenInfrastructure() {
|
||||||
this.beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
this.beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
compile((actual, compiled) -> {
|
compile((actual, compiled) -> {
|
||||||
assertThat(compiled.getSourceFile())
|
assertThat(compiled.getSourceFile()).contains("setRole(BeanDefinition.ROLE_INFRASTRUCTURE);");
|
||||||
.contains("setRole(BeanDefinition.ROLE_INFRASTRUCTURE);");
|
|
||||||
assertThat(actual.getRole()).isEqualTo(BeanDefinition.ROLE_INFRASTRUCTURE);
|
assertThat(actual.getRole()).isEqualTo(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -206,8 +201,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
void setRoleWhenSupport() {
|
void setRoleWhenSupport() {
|
||||||
this.beanDefinition.setRole(BeanDefinition.ROLE_SUPPORT);
|
this.beanDefinition.setRole(BeanDefinition.ROLE_SUPPORT);
|
||||||
compile((actual, compiled) -> {
|
compile((actual, compiled) -> {
|
||||||
assertThat(compiled.getSourceFile())
|
assertThat(compiled.getSourceFile()).contains("setRole(BeanDefinition.ROLE_SUPPORT);");
|
||||||
.contains("setRole(BeanDefinition.ROLE_SUPPORT);");
|
|
||||||
assertThat(actual.getRole()).isEqualTo(BeanDefinition.ROLE_SUPPORT);
|
assertThat(actual.getRole()).isEqualTo(BeanDefinition.ROLE_SUPPORT);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -215,18 +209,15 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
@Test
|
@Test
|
||||||
void setRoleWhenOther() {
|
void setRoleWhenOther() {
|
||||||
this.beanDefinition.setRole(999);
|
this.beanDefinition.setRole(999);
|
||||||
compile(
|
compile((actual, compiled) -> assertThat(actual.getRole()).isEqualTo(999));
|
||||||
(actual, compiled) -> assertThat(actual.getRole()).isEqualTo(999));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void setInitMethodWhenSingleInitMethod() {
|
void setInitMethodWhenSingleInitMethod() {
|
||||||
this.beanDefinition.setTargetType(InitDestroyBean.class);
|
this.beanDefinition.setTargetType(InitDestroyBean.class);
|
||||||
this.beanDefinition.setInitMethodName("i1");
|
this.beanDefinition.setInitMethodName("i1");
|
||||||
compile((actual, compiled) -> assertThat(actual.getInitMethodNames())
|
compile((actual, compiled) -> assertThat(actual.getInitMethodNames()).containsExactly("i1"));
|
||||||
.containsExactly("i1"));
|
assertHasMethodInvokeHints(InitDestroyBean.class, "i1");
|
||||||
String[] methodNames = { "i1" };
|
|
||||||
assertHasMethodInvokeHints(InitDestroyBean.class, methodNames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -239,21 +230,16 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
void setInitMethodWhenMultipleInitMethods() {
|
void setInitMethodWhenMultipleInitMethods() {
|
||||||
this.beanDefinition.setTargetType(InitDestroyBean.class);
|
this.beanDefinition.setTargetType(InitDestroyBean.class);
|
||||||
this.beanDefinition.setInitMethodNames("i1", "i2");
|
this.beanDefinition.setInitMethodNames("i1", "i2");
|
||||||
compile((actual, compiled) -> assertThat(actual.getInitMethodNames())
|
compile((actual, compiled) -> assertThat(actual.getInitMethodNames()).containsExactly("i1", "i2"));
|
||||||
.containsExactly("i1", "i2"));
|
assertHasMethodInvokeHints(InitDestroyBean.class, "i1", "i2");
|
||||||
String[] methodNames = { "i1", "i2" };
|
|
||||||
assertHasMethodInvokeHints(InitDestroyBean.class, methodNames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void setDestroyMethodWhenDestroyInitMethod() {
|
void setDestroyMethodWhenDestroyInitMethod() {
|
||||||
this.beanDefinition.setTargetType(InitDestroyBean.class);
|
this.beanDefinition.setTargetType(InitDestroyBean.class);
|
||||||
this.beanDefinition.setDestroyMethodName("d1");
|
this.beanDefinition.setDestroyMethodName("d1");
|
||||||
compile(
|
compile((actual, compiled) -> assertThat(actual.getDestroyMethodNames()).containsExactly("d1"));
|
||||||
(actual, compiled) -> assertThat(actual.getDestroyMethodNames())
|
assertHasMethodInvokeHints(InitDestroyBean.class, "d1");
|
||||||
.containsExactly("d1"));
|
|
||||||
String[] methodNames = { "d1" };
|
|
||||||
assertHasMethodInvokeHints(InitDestroyBean.class, methodNames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -266,11 +252,8 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
void setDestroyMethodWhenMultipleDestroyMethods() {
|
void setDestroyMethodWhenMultipleDestroyMethods() {
|
||||||
this.beanDefinition.setTargetType(InitDestroyBean.class);
|
this.beanDefinition.setTargetType(InitDestroyBean.class);
|
||||||
this.beanDefinition.setDestroyMethodNames("d1", "d2");
|
this.beanDefinition.setDestroyMethodNames("d1", "d2");
|
||||||
compile(
|
compile((actual, compiled) -> assertThat(actual.getDestroyMethodNames()).containsExactly("d1", "d2"));
|
||||||
(actual, compiled) -> assertThat(actual.getDestroyMethodNames())
|
assertHasMethodInvokeHints(InitDestroyBean.class, "d1", "d2");
|
||||||
.containsExactly("d1", "d2"));
|
|
||||||
String[] methodNames = { "d1", "d2" };
|
|
||||||
assertHasMethodInvokeHints(InitDestroyBean.class, methodNames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertHasMethodInvokeHints(Class<?> beanType, String... methodNames) {
|
private void assertHasMethodInvokeHints(Class<?> beanType, String... methodNames) {
|
||||||
|
@ -281,15 +264,11 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void constructorArgumentValuesWhenValues() {
|
void constructorArgumentValuesWhenValues() {
|
||||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(0,
|
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(0, String.class);
|
||||||
String.class);
|
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(1, "test");
|
||||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(1,
|
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(2, 123);
|
||||||
"test");
|
|
||||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(2,
|
|
||||||
123);
|
|
||||||
compile((actual, compiled) -> {
|
compile((actual, compiled) -> {
|
||||||
Map<Integer, ValueHolder> values = actual.getConstructorArgumentValues()
|
Map<Integer, ValueHolder> values = actual.getConstructorArgumentValues().getIndexedArgumentValues();
|
||||||
.getIndexedArgumentValues();
|
|
||||||
assertThat(values.get(0).getValue()).isEqualTo(String.class);
|
assertThat(values.get(0).getValue()).isEqualTo(String.class);
|
||||||
assertThat(values.get(1).getValue()).isEqualTo("test");
|
assertThat(values.get(1).getValue()).isEqualTo("test");
|
||||||
assertThat(values.get(2).getValue()).isEqualTo(123);
|
assertThat(values.get(2).getValue()).isEqualTo(123);
|
||||||
|
@ -305,20 +284,17 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
assertThat(actual.getPropertyValues().get("test")).isEqualTo(String.class);
|
assertThat(actual.getPropertyValues().get("test")).isEqualTo(String.class);
|
||||||
assertThat(actual.getPropertyValues().get("spring")).isEqualTo("framework");
|
assertThat(actual.getPropertyValues().get("spring")).isEqualTo("framework");
|
||||||
});
|
});
|
||||||
String[] methodNames = { "setTest", "setSpring" };
|
assertHasMethodInvokeHints(PropertyValuesBean.class, "setTest", "setSpring");
|
||||||
assertHasMethodInvokeHints(PropertyValuesBean.class, methodNames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void propertyValuesWhenContainsBeanReference() {
|
void propertyValuesWhenContainsBeanReference() {
|
||||||
this.beanDefinition.getPropertyValues().add("myService",
|
this.beanDefinition.getPropertyValues().add("myService", new RuntimeBeanNameReference("test"));
|
||||||
new RuntimeBeanNameReference("test"));
|
|
||||||
compile((actual, compiled) -> {
|
compile((actual, compiled) -> {
|
||||||
assertThat(actual.getPropertyValues().contains("myService")).isTrue();
|
assertThat(actual.getPropertyValues().contains("myService")).isTrue();
|
||||||
assertThat(actual.getPropertyValues().get("myService"))
|
assertThat(actual.getPropertyValues().get("myService"))
|
||||||
.isInstanceOfSatisfying(RuntimeBeanReference.class,
|
.isInstanceOfSatisfying(RuntimeBeanReference.class,
|
||||||
beanReference -> assertThat(beanReference.getBeanName())
|
beanReference -> assertThat(beanReference.getBeanName()).isEqualTo("test"));
|
||||||
.isEqualTo("test"));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,8 +318,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
compile((actual, compiled) -> {
|
compile((actual, compiled) -> {
|
||||||
Object value = actual.getPropertyValues().get("value");
|
Object value = actual.getPropertyValues().get("value");
|
||||||
assertThat(value).isInstanceOf(ManagedSet.class);
|
assertThat(value).isInstanceOf(ManagedSet.class);
|
||||||
assertThat(((Set<?>) value).iterator().next())
|
assertThat(((Set<?>) value).iterator().next()).isInstanceOf(BeanReference.class);
|
||||||
.isInstanceOf(BeanReference.class);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,8 +344,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
assertThat(actual.getPropertyValues().get("prefix")).isEqualTo("Hello");
|
assertThat(actual.getPropertyValues().get("prefix")).isEqualTo("Hello");
|
||||||
assertThat(actual.getPropertyValues().get("name")).isEqualTo("World");
|
assertThat(actual.getPropertyValues().get("name")).isEqualTo("World");
|
||||||
});
|
});
|
||||||
String[] methodNames = { "setPrefix", "setName" };
|
assertHasMethodInvokeHints(PropertyValuesFactoryBean.class, "setPrefix", "setName" );
|
||||||
assertHasMethodInvokeHints(PropertyValuesFactoryBean.class, methodNames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -449,9 +423,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
compile(attribute -> true, result);
|
compile(attribute -> true, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compile(
|
private void compile(Predicate<String> attributeFilter, BiConsumer<RootBeanDefinition, Compiled> result) {
|
||||||
Predicate<String> attributeFilter,
|
|
||||||
BiConsumer<RootBeanDefinition, Compiled> result) {
|
|
||||||
DeferredTypeBuilder typeBuilder = new DeferredTypeBuilder();
|
DeferredTypeBuilder typeBuilder = new DeferredTypeBuilder();
|
||||||
GeneratedClass generatedClass = this.generationContext.getGeneratedClasses().addForFeature("TestCode", typeBuilder);
|
GeneratedClass generatedClass = this.generationContext.getGeneratedClasses().addForFeature("TestCode", typeBuilder);
|
||||||
BeanDefinitionPropertiesCodeGenerator codeGenerator = new BeanDefinitionPropertiesCodeGenerator(
|
BeanDefinitionPropertiesCodeGenerator codeGenerator = new BeanDefinitionPropertiesCodeGenerator(
|
||||||
|
@ -471,8 +443,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||||
});
|
});
|
||||||
this.generationContext.writeGeneratedContent();
|
this.generationContext.writeGeneratedContent();
|
||||||
TestCompiler.forSystem().with(this.generationContext).compile(compiled -> {
|
TestCompiler.forSystem().with(this.generationContext).compile(compiled -> {
|
||||||
RootBeanDefinition suppliedBeanDefinition = (RootBeanDefinition) compiled
|
RootBeanDefinition suppliedBeanDefinition = (RootBeanDefinition) compiled.getInstance(Supplier.class).get();
|
||||||
.getInstance(Supplier.class).get();
|
|
||||||
result.accept(suppliedBeanDefinition, compiled);
|
result.accept(suppliedBeanDefinition, compiled);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue