Fork me on GitHub

@Component 注解

@Component

源码

/**
 * Indicates that an annotated class is a "component".
 	表名注解类是一个 “组件”
 * Such classes are considered as candidates for auto-detection
 * when using annotation-based configuration and classpath scanning.
 	当基于注解配置和类路径扫描的时候,这些类被认为是自动探测的候选类 (candidates)
 * <p>Other class-level annotations may be considered as identifying
 * a component as well, typically a special kind of component:
 	其他登记的注解也可能被认为是识别一个组件,典型的类如一种特殊的组件:
 * e.g. the {@link Repository @Repository} annotation or AspectJ's
 * {@link org.aspectj.lang.annotation.Aspect @Aspect} annotation.
 	@Repository 注解或者 AspectJ 的 @Aspect 注解
 *
 * @author Mark Fisher
 * @since 2.5
 * @see Repository
 * @see Service
 * @see Controller
 * @see org.springframework.context.annotation.ClassPathBeanDefinitionScanner
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Indexed
public @interface Component {

	/**
	 * The value may indicate a suggestion for a logical component name,
	 * to be turned into a Spring bean in case of an autodetected component.
	 * @return the suggested component name, if any (or empty String otherwise)
	 */
	String value() default "";

}
posted @ 2021-08-06 14:57  icewalnut  阅读(251)  评论(0编辑  收藏  举报