Add RootBeanDefinition constructor that accepts a ResolvableType
Add a new convenience constructor to `RootBeanDefinition` that allow it to be created with a `ResolvableType`. Closes gh-28418
This commit is contained in:
parent
4b82546b97
commit
d31eb4c0f1
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -125,8 +125,7 @@ public final class BeanDefinitionBuilder {
|
|||
* @since 5.3.9
|
||||
*/
|
||||
public static <T> BeanDefinitionBuilder rootBeanDefinition(ResolvableType beanType, Supplier<T> instanceSupplier) {
|
||||
RootBeanDefinition beanDefinition = new RootBeanDefinition();
|
||||
beanDefinition.setTargetType(beanType);
|
||||
RootBeanDefinition beanDefinition = new RootBeanDefinition(beanType);
|
||||
beanDefinition.setInstanceSupplier(instanceSupplier);
|
||||
return new BeanDefinitionBuilder(beanDefinition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,6 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
|||
* @see #setPropertyValues
|
||||
*/
|
||||
public RootBeanDefinition() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -148,10 +147,18 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
|||
* @see #setBeanClass
|
||||
*/
|
||||
public RootBeanDefinition(@Nullable Class<?> beanClass) {
|
||||
super();
|
||||
setBeanClass(beanClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new RootBeanDefinition for a singleton.
|
||||
* @param beanType the type of bean to instantiate
|
||||
* @see #setTargetType(ResolvableType)
|
||||
*/
|
||||
public RootBeanDefinition(@Nullable ResolvableType beanType) {
|
||||
setTargetType(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new RootBeanDefinition for a singleton bean, constructing each instance
|
||||
* through calling the given supplier (possibly a lambda or method reference).
|
||||
|
|
@ -193,7 +200,6 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
|||
* (not applicable to autowiring a constructor, thus ignored there)
|
||||
*/
|
||||
public RootBeanDefinition(@Nullable Class<?> beanClass, int autowireMode, boolean dependencyCheck) {
|
||||
super();
|
||||
setBeanClass(beanClass);
|
||||
setAutowireMode(autowireMode);
|
||||
if (dependencyCheck && getResolvedAutowireMode() != AUTOWIRE_CONSTRUCTOR) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue