org.springframework.beans.factory.annotation

## 注释类型 Lookup

-     @Target(value=METHOD)
       @Retention(value=RUNTIME)
       @Documented
      public @interface Lookup

  An annotation that indicates 'lookup' methods, to be overridden by the container to redirect them back to the `BeanFactory` for a `getBean` call. This is essentially an annotation-based version of the XML `lookup-method` attribute, resulting in the same runtime arrangement.

  The resolution of the target bean can either be based on the return type (`getBean(Class)`) or on a suggested bean name (`getBean(String)`), in both cases passing the method's arguments to the `getBean` call for applying them as target factory method arguments or constructor arguments.

  Such lookup methods can have default (stub) implementations that will simply get replaced by the container, or they can be declared as abstract - for the container to fill them in at runtime. In both cases, the container will generate runtime subclasses of the method's containing class via CGLIB, which is why such lookup methods can only work on beans that the container instantiates through regular constructors: i.e. lookup methods cannot get replaced on beans returned from factory methods where we cannot dynamically provide a subclass for them.

  Concrete limitations in typical Spring configuration scenarios: When used with component scanning or any other mechanism that filters out abstract beans, provide stub implementations of your lookup methods to be able to declare them as concrete classes. And please remember that lookup methods won't work on beans returned from `@Bean` methods in configuration classes; you'll have to resort to `@Inject Provider<TargetBean>` or the like instead.

  从以下版本开始:
    4.1
  作者:
    Juergen Hoeller
  另请参阅:
    `BeanFactory.getBean(Class, Object...)`, `BeanFactory.getBean(String, Object...)`

- - ### 可选元素概要

    可选元素
    限定符和类型 | 可选元素和说明
    --- | ---
    `String` | `value` This annotation attribute may suggest a target bean name to look up.

- - ### 元素详细资料

    - #### value

          public abstract String value

      This annotation attribute may suggest a target bean name to look up. If not specified, the target bean will be resolved based on the annotated method's return type declaration.
      默认值:
        ""