首页 > 其他分享 >Annotation

Annotation

时间:2022-10-14 18:13:43浏览次数:37  
标签:定义 Annotation source Inherited 注解 class Target

@Override //重写方法
@Deprecated //不推荐程序员使用,但是可以使用。或者存在更好的方式
@SuppressWarnings("all") //镇压警告
//Target 表示我们的注解可以用在哪些地方。
@Target(value = {ElementType.METHOD, ElementType.TYPE})

//Retention 表示我们的注解在什么地方还有效。
//runtime > class > source 定义runtime在class和source有效,定义class在source有效,定义source在source有效
@Retention(value = RetentionPolicy.RUNTIME)

//@Documented表示是否将我们的注解生成在JAVAdoc中
@Documented

//Inherited 子类可以继承父类的注解
@Inherited

//定义一个注解
@interface MyAnnotation{

}

//    注解的参数:参数类型 + 参数名 (); 注意不是方法
// String name(); -------------1
 

标签:定义,Annotation,source,Inherited,注解,class,Target
From: https://www.cnblogs.com/Chen12138/p/16792508.html

相关文章

  • annotation
    packagecom.springsecuritydemo.aspect;importcom.springsecuritydemo.domain.base.BaseCreateByAndUpdateBy;importcom.springsecuritydemo.service.security.impl.......
  • Spring annotation(jrebel.com)
    摘自https://www.jrebel.com/blog/spring-annotations-cheat-sheetAugust5,2021SpringAnnotationsCheatSheetJavaFrameworksDeveloperProductivityWe'veg......
  • 注解Annotation
    注解是一种引用数据类型,重点掌握Deprecated(表示已过时),Override(表示重写)。元注解是用来标注注解类型的注解如Target(用来标注注解可以出现在哪些位置)、Retention(用来标注最......
  • Java自定义Annotation注解开发详解
    Java自定义Annotation注解开发详解目录介绍一、运行期的自定义注解1.ClassLevelAnnotation2.MethodLevelAnnotation3.FieldLevelAnnotation4.使用自定义......
  • 解决Spring Boot Configuration Annotation Processor not configured
    解决SpringBootConfigurationAnnotationProcessornotconfigured问题背景进行SpringBoot配置文件部署时,发出警告,该爆红不影响使用,但是爆红感觉很难受,点击OpenDocu......
  • SpringBoot:Configuration Annotation Processor not configured&在Spring Boot中读取a
    您在使用@ConfigurationProperties注解时可以使用spring-boot-configuration-processorjar轻松地从带有注释的项目中生成自己的配置元数据文件。该jar包含一个Java注释处......
  • Spring 高级 AutowiredAnnotationBeanPostProcessor 运行分析
    1、AutowiredAnnotationBeanPostProcessor运行分析AutowiredAnnotationBeanPostProcessor的作用:AutowiredAnnotationBeanPostProcessor解析@Autowired与@Value----......