Do not write BeanDefinition attributes by default

This commit flips the default strategy for BeanDefinition attributes so
that they are not generated in AOT-optimized contexts.

Closes gh-28516
This commit is contained in:
Stephane Nicoll
2022-07-27 14:59:06 +02:00
parent b38a5df563
commit f0f7f72de9
2 changed files with 19 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ import org.springframework.util.Assert;
*/
class BeanRegistrationCodeGenerator implements BeanRegistrationCode {
private static final Predicate<String> NO_ATTRIBUTE_FILTER = attribute -> true;
private static final Predicate<String> REJECT_ALL_ATTRIBUTES_FILTER = attribute -> false;
private final ClassName className;
@@ -85,7 +85,7 @@ class BeanRegistrationCodeGenerator implements BeanRegistrationCode {
this.registeredBean.getBeanType(), this));
builder.add(this.codeFragments.generateSetBeanDefinitionPropertiesCode(
generationContext, this, this.registeredBean.getMergedBeanDefinition(),
NO_ATTRIBUTE_FILTER));
REJECT_ALL_ATTRIBUTES_FILTER));
CodeBlock instanceSupplierCode = this.codeFragments.generateInstanceSupplierCode(
generationContext, this, this.constructorOrFactoryMethod,
this.instancePostProcessors.isEmpty());