注解(spring cloud随笔记录)

@RestController  返回json字符串的数据,直接可以编写RESTFul的接口;

@CrossOrigin   可以处理跨域请求,让你能访问不是一个域的文件;

@ApiOperation  

  • 首先@ApiOperation注解不是Spring自带的,它是是swagger里的
  • 注解@ApiOperation是用来构建Api文档的
  • @ApiOperation(value = “接口说明”, httpMethod = “接口请求方式”, response = “接口返回参数类型”, notes = “接口发布说明”;
    使用参考链接:https://www.jianshu.com/p/8033ef83a8ed

@NotNull   被注释的元素不能为null:

    @NotNull
    private String name;
    @NotNull
    private Integer age;

@SpringBootApplication  申明让spring boot自动给程序进行必要的配置,等价于以默认属性使用@Configuration,@EnableAutoConfiguration和@ComponentScan;

@RefreshScope    如果代码中需要动态刷新配置,在需要的类上加上该注解就行。但某些复杂的注入场景下,这个注解使用不当,配置可能仍然不动态刷新;

@FeignClient    springboot调用外部接口;

猜你喜欢

转载自www.cnblogs.com/arno92/p/9768111.html