注解收集

 java原生

Java自带

@SuppressWarnings("ALL")

方法,类

吃掉警告

@Override,

方法

重写

@Deprecated

方法

不建议使用

spring

@Service  @Component  @Repository

类,注册在spring container

@Autried @qualifier

member variable

代表依赖注入

@config

class,代变配置文件

@bean

method,代变注册一个bean

@Transactional

事务控制

@Nullable

method,parameter not null,return parameter may be null

SpringBoot

@springbootApplication

class,启动

@GetMapping/ @PostMapping

 = @RequestMapping(method = RequestMethod.GET/Post)

springmvc

@controller

类,接受请求,也是注册在spring容器

@RequestMapping("/cat") / (value = "/cat")

类,方法,写映射路径,加方法method = RequestMethod.POST

@RequestBody

parameter, json 转 entity

@ResponseBody

方法,类,entity 转 json

@RestController

在类上 responseBody + controller

json

jsr验证

Lombok

val:放在local variable

 NonNull: parameter, member variable

 cleanup:resource variable自动close

 getter/ setter : member variable

tostring:class

AllArgsConstructor/ NoArgsConstructor/ RequiredArgsConstructor: 后面那个 只有final 或者 nonNull的field才能用

data:@ToString, @EqualsAndHashCode, @Getter/setter(非final)@RequiredArgsConstructor

build: 构造器模式,不搞static

synchronized: static class lock, object lock, custom lock是不同的

 getter(lazy=true)懒加载

 log和sfl4j : 两种流派的日志

JPA

 embeddable: 两个类嵌入到一个表

oneToMany:会创建新表(mappered=“value”)整合在一个表

manyToOne: 

manyToMany

原文地址:https://www.cnblogs.com/vhyc/p/12171853.html