首页 > 技术文章 > Spring boot 自定义注解

banml 2019-09-23 11:04 原文

Spring boot 自定义注解如下:

三个很重要的注解:

@Target({ElementType.PARAMETER,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented

 

代码如下:

import java.lang.annotation.*;

/**
* 测试用例级别描述
*/
@Target({ElementType.PARAMETER,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface MethodAnnotation {
/**
* 接口描述
* @return
*/
public String description() default "";

/**
* 创建时间
* @return
*/
public String createTime() default "0000-00-00";

/**
* 更新时间
* @return
*/
public String updateTime() default "0000-00-00";

/**
* 作者
* @return
*/
public String author() default "";

}

推荐阅读