Spring注解之@Import

/**
* Indicates one or more {@link Configuration @Configuration} classes to import.
* 表示import 一个或多个class
* <p>Provides functionality equivalent to the {@code <import/>} element in Spring XML.
* 等同于Spring XML 中的 <import/>的作用
* Allows for importing {@code @Configuration} classes, {@link ImportSelector} and
* {@link ImportBeanDefinitionRegistrar} implementations, as well as regular component
* classes (as of 4.2; analogous to {@link AnnotationConfigApplicationContext#register}).
* 运行的值类型 @Configuration注解的类,@ImportSelector 和 ImportBeanDefinitionRegistrar的实现类
*
* <p>{@code @Bean} definitions declared in imported {@code @Configuration} classes should be
* accessed by using {@link org.springframework.beans.factory.annotation.Autowired @Autowired}
* injection. Either the bean itself can be autowired, or the configuration class instance
* declaring the bean can be autowired. The latter approach allows for explicit, IDE-friendly
* navigation between {@code @Configuration} class methods.
* @Bean声明定义的 @Configuration实现类 通过@Autowired注入的方式访问; 不管是通过autowired 实例化还是通过
* 配置配置类 实例化声明bean. 后一种方法显示通过IDEA友好在各个方法之间导航
* <p>May be declared at the class level or as a meta-annotation.
* 可以在类级别声明,也可以作为元注释
* <p>If XML or other non-{@code @Configuration} bean definition resources need to be
* imported, use the {@link ImportResource @ImportResource} annotation instead.
*
* @author Chris Beams
* @author Juergen Hoeller
* @since 3.0
* @see Configuration
* @see ImportSelector
* @see ImportResource
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Import { /**
* {@link Configuration}, {@link ImportSelector}, {@link ImportBeanDefinitionRegistrar}
* or regular component classes to import.
*/
Class<?>[] value(); }
上一篇:git workflows


下一篇:(转)开源分布式搜索平台ELK(Elasticsearch+Logstash+Kibana)入门学习资源索引