在学习的时候发现了@RequiredArgsConstructor
注解,是Lombok下的注解,对此做笔记。
其注解的作用是省略我们项目 service层中 mapper 上的注解@AutoWired
;
或者是 controller 层中的 service 上的。
以下为例:
@RestController
@RequiredArgsConstructor
public class TestController {
@NonNull
AService aService;
@NotNull
BService bService;
final CService cService;
}
其 @NonNull \ @NotNull \ final
都有效。