Browse Source

Polishing

pull/34977/head
Juergen Hoeller 7 months ago
parent
commit
46e6783593
  1. 36
      spring-beans/src/main/java/org/springframework/beans/factory/BeanRegistry.java

36
spring-beans/src/main/java/org/springframework/beans/factory/BeanRegistry.java

@ -55,9 +55,8 @@ public interface BeanRegistry {
void registerAlias(String name, String alias); void registerAlias(String name, String alias);
/** /**
* Register a bean from the given bean class, which will be instantiated * Register a bean from the given bean class, which will be instantiated using the
* using the related {@link BeanUtils#getResolvableConstructor resolvable constructor} * related {@link BeanUtils#getResolvableConstructor resolvable constructor} if any.
* if any.
* @param beanClass the class of the bean * @param beanClass the class of the bean
* @return the generated bean name * @return the generated bean name
*/ */
@ -65,10 +64,9 @@ public interface BeanRegistry {
/** /**
* Register a bean from the given bean class, customizing it with the customizer * Register a bean from the given bean class, customizing it with the customizer
* callback. The bean will be instantiated using the supplier that can be * callback. The bean will be instantiated using the supplier that can be configured
* configured in the customizer callback, or will be tentatively instantiated * in the customizer callback, or will be tentatively instantiated with its
* with its {@link BeanUtils#getResolvableConstructor resolvable constructor} * {@link BeanUtils#getResolvableConstructor resolvable constructor} otherwise.
* otherwise.
* @param beanClass the class of the bean * @param beanClass the class of the bean
* @param customizer callback to customize other bean properties than the name * @param customizer callback to customize other bean properties than the name
* @return the generated bean name * @return the generated bean name
@ -76,9 +74,8 @@ public interface BeanRegistry {
<T> String registerBean(Class<T> beanClass, Consumer<Spec<T>> customizer); <T> String registerBean(Class<T> beanClass, Consumer<Spec<T>> customizer);
/** /**
* Register a bean from the given bean class, which will be instantiated * Register a bean from the given bean class, which will be instantiated using the
* using the related {@link BeanUtils#getResolvableConstructor resolvable constructor} * related {@link BeanUtils#getResolvableConstructor resolvable constructor} if any.
* if any.
* @param name the name of the bean * @param name the name of the bean
* @param beanClass the class of the bean * @param beanClass the class of the bean
*/ */
@ -86,8 +83,8 @@ public interface BeanRegistry {
/** /**
* Register a bean from the given bean class, customizing it with the customizer * Register a bean from the given bean class, customizing it with the customizer
* callback. The bean will be instantiated using the supplier that can be * callback. The bean will be instantiated using the supplier that can be configured
* configured in the customizer callback, or will be tentatively instantiated with its * in the customizer callback, or will be tentatively instantiated with its
* {@link BeanUtils#getResolvableConstructor resolvable constructor} otherwise. * {@link BeanUtils#getResolvableConstructor resolvable constructor} otherwise.
* @param name the name of the bean * @param name the name of the bean
* @param beanClass the class of the bean * @param beanClass the class of the bean
@ -122,8 +119,8 @@ public interface BeanRegistry {
Spec<T> fallback(); Spec<T> fallback();
/** /**
* Hint that this bean has an infrastructure role, meaning it has no * Hint that this bean has an infrastructure role, meaning it has no relevance
* relevance to the end-user. * to the end-user.
* @see BeanDefinition#setRole(int) * @see BeanDefinition#setRole(int)
* @see BeanDefinition#ROLE_INFRASTRUCTURE * @see BeanDefinition#ROLE_INFRASTRUCTURE
*/ */
@ -136,8 +133,7 @@ public interface BeanRegistry {
Spec<T> lazyInit(); Spec<T> lazyInit();
/** /**
* Configure this bean as not a candidate for getting autowired into some * Configure this bean as not a candidate for getting autowired into another bean.
* other bean.
* @see BeanDefinition#setAutowireCandidate(boolean) * @see BeanDefinition#setAutowireCandidate(boolean)
*/ */
Spec<T> notAutowirable(); Spec<T> notAutowirable();
@ -184,6 +180,7 @@ public interface BeanRegistry {
Spec<T> targetType(ResolvableType type); Spec<T> targetType(ResolvableType type);
} }
/** /**
* Context available from the bean instance supplier designed to give access * Context available from the bean instance supplier designed to give access
* to bean dependencies. * to bean dependencies.
@ -191,10 +188,8 @@ public interface BeanRegistry {
interface SupplierContext { interface SupplierContext {
/** /**
* Return the bean instance that uniquely matches the given object type, * Return the bean instance that uniquely matches the given object type, if any.
* if any. * @param requiredType type the bean must match; can be an interface or superclass
* @param requiredType type the bean must match; can be an interface or
* superclass
* @return an instance of the single bean matching the required type * @return an instance of the single bean matching the required type
* @see BeanFactory#getBean(String) * @see BeanFactory#getBean(String)
*/ */
@ -240,4 +235,5 @@ public interface BeanRegistry {
*/ */
<T> ObjectProvider<T> beanProvider(ResolvableType requiredType); <T> ObjectProvider<T> beanProvider(ResolvableType requiredType);
} }
} }

Loading…
Cancel
Save