Deprecate AutowireCapableBeanFactory.createBean(Class, int, boolean)

Includes consistent usage of createBean(Class) in SpringBeanJobFactory and SpringBeanContainer.

Closes gh-30345
See gh-29855
See gh-30041
This commit is contained in:
Juergen Hoeller
2023-04-30 23:07:29 +02:00
parent 4d15b58ca4
commit d39e44c209
6 changed files with 10 additions and 14 deletions

View File

@@ -64,7 +64,6 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
/**
* Constant that indicates no externally defined autowiring. Note that
* BeanFactoryAware etc and annotation-driven injection will still be applied.
* @see #createBean
* @see #autowire
* @see #autowireBeanProperties
*/
@@ -73,7 +72,6 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
/**
* Constant that indicates autowiring bean properties by name
* (applying to all bean property setters).
* @see #createBean
* @see #autowire
* @see #autowireBeanProperties
*/
@@ -82,7 +80,6 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
/**
* Constant that indicates autowiring bean properties by type
* (applying to all bean property setters).
* @see #createBean
* @see #autowire
* @see #autowireBeanProperties
*/
@@ -91,7 +88,6 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
/**
* Constant that indicates autowiring the greediest constructor that
* can be satisfied (involves resolving the appropriate constructor).
* @see #createBean
* @see #autowire
*/
int AUTOWIRE_CONSTRUCTOR = 3;
@@ -99,7 +95,6 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
/**
* Constant that indicates determining an appropriate autowire strategy
* through introspection of the bean class.
* @see #createBean
* @see #autowire
* @deprecated as of Spring 3.0: If you are using mixed autowiring strategies,
* prefer annotation-based autowiring for clearer demarcation of autowiring needs.
@@ -192,7 +187,9 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
* @see #AUTOWIRE_BY_NAME
* @see #AUTOWIRE_BY_TYPE
* @see #AUTOWIRE_CONSTRUCTOR
* @deprecated as of 6.1, in favor of {@link #createBean(Class)}
*/
@Deprecated(since = "6.1")
Object createBean(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
/**
@@ -322,7 +319,7 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
throws BeansException;
/**
* Destroy the given bean instance (typically coming from {@link #createBean}),
* Destroy the given bean instance (typically coming from {@link #createBean(Class)}),
* applying the {@link org.springframework.beans.factory.DisposableBean} contract as well as
* registered {@link DestructionAwareBeanPostProcessor DestructionAwareBeanPostProcessors}.
* <p>Any exception that arises during destruction should be caught

View File

@@ -357,6 +357,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
// Specialized methods for fine-grained control over the bean lifecycle
//-------------------------------------------------------------------------
@Deprecated
@Override
public Object createBean(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
// Use non-singleton bean definition, to avoid registering bean as dependent bean.