注解

注解

如何创建注解

  • 添加元注解
    • @Target:注解添加的位置
    • @Retention:注解运行的时间
    • @Documented:是否记录为javadoc
    • @Inherited:子类是否可以继承父类的注解
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Controller {

	/**
	 * 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 @ 2020-04-22 09:22  不爱吃西红柿  阅读(135)  评论(0编辑  收藏  举报