Browse Source

Polish

pull/31470/head
Stéphane Nicoll 1 year ago
parent
commit
cf10cee16a
  1. 9
      spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
  2. 2
      spring-beans/src/main/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragments.java

9
spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java

@ -1046,12 +1046,9 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
} }
private CodeBlock generateParameterTypesCode(Class<?>[] parameterTypes) { private CodeBlock generateParameterTypesCode(Class<?>[] parameterTypes) {
CodeBlock.Builder code = CodeBlock.builder(); return CodeBlock.join(Arrays.stream(parameterTypes)
for (int i = 0; i < parameterTypes.length; i++) { .map(parameterType -> CodeBlock.of("$T.class", parameterType))
code.add((i != 0 ? ", " : "")); .toList(), ", ");
code.add("$T.class", parameterTypes[i]);
}
return code.build();
} }
private void registerHints(RuntimeHints runtimeHints) { private void registerHints(RuntimeHints runtimeHints) {

2
spring-beans/src/main/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragments.java

@ -235,7 +235,7 @@ class DefaultBeanRegistrationCodeFragments implements BeanRegistrationCodeFragme
} }
return new InstanceSupplierCodeGenerator(generationContext, return new InstanceSupplierCodeGenerator(generationContext,
beanRegistrationCode.getClassName(), beanRegistrationCode.getMethods(), allowDirectSupplierShortcut) beanRegistrationCode.getClassName(), beanRegistrationCode.getMethods(), allowDirectSupplierShortcut)
.generateCode(this.registeredBean,this.constructorOrFactoryMethod.get()); .generateCode(this.registeredBean, this.constructorOrFactoryMethod.get());
} }
@Override @Override

Loading…
Cancel
Save