lombok
idea安装:https://blog.csdn.net/zhglance/article/details/54931430
eclipse安装:https://blog.csdn.net/arkblue/article/details/52608213
注解介绍
@AllArgsConstructor 替代@Autowired构造注入,多个bean 注入时更加清晰
@Slf4j
@Configuration
@AllArgsConstructor
public class RouterFunctionConfiguration {
private final HystrixFallbackHandler hystrixFallbackHandler;
private final ImageCodeHandler imageCodeHandler;
}
@Slf4j
@Configuration
public class RouterFunctionConfiguration {
@Autowired
private HystrixFallbackHandler hystrixFallbackHandler;
@Autowired
private ImageCodeHandler imageCodeHandler;
}
@SneakyThrows
@SneakyThrows
private void checkCode(ServerHttpRequest request) {
String code = request.getQueryParams().getFirst("code");
if (StrUtil.isBlank(code)) {
throw new ValidateCodeException("验证码不能为空");
}
redisTemplate.delete(key);
}
// 不使用就要加这个抛出
private void checkCode(ServerHttpRequest request) throws ValidateCodeException {
String code = request.getQueryParams().getFirst("code");
if (StrUtil.isBlank(code)) {
throw new ValidateCodeException("验证码不能为空");
}
}
@UtilityClass 工具类再也不用定义static的方法了,直接就可以Class.Method
@UtilityClass
public class Utility {
public String getName() {
return "name";
}
}
public static void main(String[] args) {
System.out.println(Utility.getName());
}
@Data @Getter/Setter注解