Merge branch '6.1.x'
This commit is contained in:
commit
8cfdaaaabc
|
@ -135,8 +135,9 @@ class ScopedProxyBeanRegistrationAotProcessor implements BeanRegistrationAotProc
|
|||
}
|
||||
|
||||
@Override
|
||||
public CodeBlock generateInstanceSupplierCode(GenerationContext generationContext,
|
||||
BeanRegistrationCode beanRegistrationCode, boolean allowDirectSupplierShortcut) {
|
||||
public CodeBlock generateInstanceSupplierCode(
|
||||
GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode,
|
||||
boolean allowDirectSupplierShortcut) {
|
||||
|
||||
GeneratedMethod generatedMethod = beanRegistrationCode.getMethods()
|
||||
.add("getScopedProxyInstance", method -> {
|
||||
|
|
|
@ -101,8 +101,7 @@ class DefaultBeanRegistrationCodeFragments implements BeanRegistrationCodeFragme
|
|||
/**
|
||||
* Extract the target class of a public {@link FactoryBean} based on its
|
||||
* constructor. If the implementation does not resolve the target class
|
||||
* because it itself uses a generic, attempt to extract it from the
|
||||
* bean type.
|
||||
* because it itself uses a generic, attempt to extract it from the bean type.
|
||||
* @param factoryBeanType the factory bean type
|
||||
* @param beanType the bean type
|
||||
* @return the target class to use
|
||||
|
@ -169,9 +168,11 @@ class DefaultBeanRegistrationCodeFragments implements BeanRegistrationCodeFragme
|
|||
|
||||
Loader loader = AotServices.factories(this.registeredBean.getBeanFactory().getBeanClassLoader());
|
||||
List<Delegate> additionalDelegates = loader.load(Delegate.class).asList();
|
||||
return new BeanDefinitionPropertiesCodeGenerator(generationContext.getRuntimeHints(),
|
||||
attributeFilter, beanRegistrationCode.getMethods(),
|
||||
additionalDelegates, (name, value) -> generateValueCode(generationContext, name, value))
|
||||
|
||||
return new BeanDefinitionPropertiesCodeGenerator(
|
||||
generationContext.getRuntimeHints(), attributeFilter,
|
||||
beanRegistrationCode.getMethods(), additionalDelegates,
|
||||
(name, value) -> generateValueCode(generationContext, name, value))
|
||||
.generateCode(beanDefinition);
|
||||
}
|
||||
|
||||
|
@ -230,8 +231,8 @@ class DefaultBeanRegistrationCodeFragments implements BeanRegistrationCodeFragme
|
|||
if (hasInstanceSupplier()) {
|
||||
throw new AotBeanProcessingException(this.registeredBean, "instance supplier is not supported");
|
||||
}
|
||||
return new InstanceSupplierCodeGenerator(generationContext, beanRegistrationCode.getClassName(),
|
||||
beanRegistrationCode.getMethods(), allowDirectSupplierShortcut)
|
||||
return new InstanceSupplierCodeGenerator(generationContext,
|
||||
beanRegistrationCode.getClassName(), beanRegistrationCode.getMethods(), allowDirectSupplierShortcut)
|
||||
.generateCode(this.registeredBean, this.instantiationDescriptor.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -761,12 +761,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
|||
}
|
||||
|
||||
private CodeBlock handleNull(@Nullable Object value, Supplier<CodeBlock> nonNull) {
|
||||
if (value == null) {
|
||||
return CodeBlock.of("null");
|
||||
}
|
||||
else {
|
||||
return nonNull.get();
|
||||
}
|
||||
return (value == null ? CodeBlock.of("null") : nonNull.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -786,9 +781,9 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
|||
}
|
||||
|
||||
@Override
|
||||
public CodeBlock generateSetBeanDefinitionPropertiesCode(GenerationContext generationContext,
|
||||
BeanRegistrationCode beanRegistrationCode, RootBeanDefinition beanDefinition,
|
||||
Predicate<String> attributeFilter) {
|
||||
public CodeBlock generateSetBeanDefinitionPropertiesCode(
|
||||
GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode,
|
||||
RootBeanDefinition beanDefinition, Predicate<String> attributeFilter) {
|
||||
|
||||
CodeBlock.Builder code = CodeBlock.builder();
|
||||
code.add(super.generateSetBeanDefinitionPropertiesCode(generationContext,
|
||||
|
@ -799,11 +794,13 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
|||
}
|
||||
|
||||
@Override
|
||||
public CodeBlock generateInstanceSupplierCode(GenerationContext generationContext,
|
||||
BeanRegistrationCode beanRegistrationCode, boolean allowDirectSupplierShortcut) {
|
||||
public CodeBlock generateInstanceSupplierCode(
|
||||
GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode,
|
||||
boolean allowDirectSupplierShortcut) {
|
||||
|
||||
InstantiationDescriptor instantiationDescriptor = proxyInstantiationDescriptor(
|
||||
generationContext.getRuntimeHints(), this.registeredBean.resolveInstantiationDescriptor());
|
||||
|
||||
return new InstanceSupplierCodeGenerator(generationContext,
|
||||
beanRegistrationCode.getClassName(), beanRegistrationCode.getMethods(), allowDirectSupplierShortcut)
|
||||
.generateCode(this.registeredBean, instantiationDescriptor);
|
||||
|
|
Loading…
Reference in New Issue