
springboot
一只努力的程序媛鸭
君子坦荡荡,小人长戚戚
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
@Vaild,@Validated,@NotNull,@NotBlank,@NotEmpty史上最全用法以及各种踩坑细节
首先常规用法 实体类中 @ApiModelProperty(notes = "用户名称") @TableField(value = "user") @NotNull(message = "合同编号不能为空") @Length(max = 50,message = "最大长度不可超过50") private String user; @ApiModelProperty(notes = "用户编码") @TableField(value = "code"原创 2022-03-19 21:02:54 · 1391 阅读 · 0 评论 -
使用注解统一判断字段非空
实体类中需要判断非空的成员变量加上注解 @ApiModelProperty(value = "标题") @NotBlank(message = "标题不得为空") private String title; @ApiModelProperty(value = "标题") @NotNull(message = "标题不得为空") private String title; controller中接收实体类加上注解 @RequestBody @Validated NpTi原创 2021-04-21 15:15:58 · 1501 阅读 · 0 评论 -
springboot 自定义异常处理
BaseResponse是返回给前端的封装对象,捕获到后返回给前端异常信息 import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.AccessDeniedException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework原创 2021-04-20 11:27:49 · 235 阅读 · 0 评论 -
操作文件最全工具类,上传下载批量压缩输出
package com.yss.base.utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.net.ssl.*; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URL; import java.net.URLConnection; import java.security.cert.Ce原创 2021-04-19 14:11:46 · 80 阅读 · 0 评论 -
netty客户端&服务端工具类
服务端 pom文件 <dependencies> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>4.1.60.Final</version> </dependency>原创 2021-04-13 15:02:05 · 1114 阅读 · 0 评论 -
date入参返回参数的格式问题
前端往后端传,后端接收加 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") 后端往前端返回,前端接收加 @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")原创 2021-04-08 17:19:35 · 344 阅读 · 0 评论 -
java定时器
启动类中加上注解 @EnableScheduling 需要定时执行的方法注解 @Scheduled(cron = "0 0 1 * * *") public void uploadDeposit(){} 表达式 秒:可出现", - * /"四个字符,有效范围为0-59的整数 分:可出现", - * /"四个字符,有效范围为0-59的整数 时:可出现", - * /"四个字符,有效范围为0-23的整数 每月第几天:可出现", - * / ? L W C"八个字符,有效范围为0-31的原创 2021-03-30 09:09:51 · 142 阅读 · 0 评论 -
com.nms.yyterpmaster.core.adapter.impl.UserAdapterImpl required a single bean, but 2 were found:解决
报错扫描出多个bean的问题 Description: Field roleService in com.nms.yyterpmaster.core.adapter.impl.UserAdapterImpl required a single bean, but 2 were found: - roleServiceImpl: defined in file [E:\java_Project_warehouse\yyt-erp-master\target\classes\com\nms\yyterpma原创 2021-03-18 20:21:23 · 99 阅读 · 0 评论