- 博客(11)
- 资源 (3)
- 收藏
- 关注
转载 Spring Boot学习笔记(二十一)Spring boot 数据校验 @Validated、@Valid用法详解
文章目录约束注解(大多为 `javax.validation.constraints` 下的注解)启用校验使用消息示例进阶总结后端数据校验(JSR303/JSR-349、javax validation、hibernate validation、spring validation)后端数据校验如:请求参数不能为null、数值至少为5、email参数符合邮箱地址规则等,通常涉及到上述几种工具,其区别:JSR303/JSR-349、javax validation:JSR303是一项标准、JSR-349
2020-08-27 14:52:05 1885
原创 Spring Boot学习笔记(二十)拦截器设计、开发、多拦截器的顺序讲解
1. 拦截器的设计所有的拦截器都需要继承HandlerInterceptor接口,该接口源码如下public interface HandlerInterceptor { /** * 在请求处理之前进行调用(Controller方法调用之前) */ default boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Ex
2020-08-26 13:54:10 929
原创 Spring Boot学习笔记(十九)使用@RestControllerAdvice 统一返回信息格式,统一处理错误返回给前端的信息
参考Spring Boot @RestControllerAdvice 统一异常处理、@RestControllerAdvice构造统一返回值格式和统一异常处理、SpringBoot 使用 beforeBodyWrite 实现统一的接口返回类型1.创建好我们的统一返回格式//这些是lombok的注解@Data@NoArgsConstructor @AllArgsConstructorpublic class CommonResponse<T> { private boolea
2020-08-25 16:58:00 3769 2
原创 Spring Boot学习笔记(十八)如何使用@NotBlank进行空校验,以及@NotBlank 与 @Valid 搭配无效的解决办法
我们的Controller如下所示import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RestController;import javax.validation.Valid;@RestControllerpublic
2020-08-24 19:49:34 3779
原创 2020.8.19 解决Spring boot 中 使用redis进行缓存时乱码的问题
关于springboot 中使用 redis缓存的详细介绍,可以看我的文章:Spring Boot学习笔记(十七)整合 mysql、mybatis-plus 使用redis进行缓存解决办法很简单,添加一个配置文件即可,文件路径没有什么要求,因为 spring boot是根据 @Configuration 注解来进行配置重点的代码是:RedisSerializer.string()、RedisSerializer.json()@Configurationpublic class RedisCon
2020-08-19 17:32:17 303
原创 Spring Boot学习笔记(十七)整合 mysql、mybatis-plus 使用redis进行缓存(带工程源码)
文章目录1. 给springboot 工程添加pom依赖2. 在application中进行配置3. 启用缓存机制4. 开发缓存注解4.1 编写实体类SpringBootUser4.2 编写mybatis-plus相关文件4.3 编写调用方法1. 给springboot 工程添加pom依赖 <dependency> <groupId>mysql</groupId> <artifactId>mys
2020-08-19 17:23:53 1226 1
原创 用cmd解决 spring boot项目启动报错:Web server failed to start. Port 8080 was already in use.
文章目录方法二:修改spring boot项目所监听的端口常见报错:Description:Web server failed to start. Port 8080 was already in use.Action:Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.Process finished with
2020-08-19 11:34:47 2430
原创 element-ui tabs隐藏某个标签(v-show不起作用的解决方法)
文章目录解决方法v-show 为什么不起作用呢解决方法直接展示代码,代码如下所示<template> <div id="app"> <el-tabs v-model="activeName" @tab-click="handleClick"> <el-tab-pane v-for="(item, index) in elTabs" :key="index" :label="item.label" :name="item.name">
2020-08-19 10:33:08 4066 2
原创 Java进阶学习笔记(十二)Java8重要特性stream详解
https://www.cnblogs.com/wuhenzhidu/p/10740091.html
2020-08-18 10:53:15 285
原创 Spring Boot学习笔记(十六)@Autowired和使用 new()区别
1.使用上的区别大家在使用@Autowired注解的时候,肯定会有疑惑,这个地方我使用@Autowired注入,和我使用new,这种写法的作用有什么区别呢?最重要的一点,使用new创建的对象,无法调用Spring容器内的实例。即 new出来的对象无法调用@Autowired注入的Spring Bean,否则报空指针异常,@Autowired注入Spring Bean,则当前类必须也是Spring Bean才能调用它,不能用new xxx()来获得对象,这种方式获得的对象无法调用@Autowired注
2020-08-13 16:06:27 4183
转载 Spring Boot学习笔记(十五)mybatis(二)mybatis常用增删改查xml
我们利用以下sql,准备好我们的数据库-- 若有则删除DROP DATABASE IF EXISTS `blog_db`;-- 创建数据库CREATE DATABASE `blog_db` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;-- 用户表CREATE TABLE `blog_db`.`user` ( `id` BIGINT NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT
2020-08-02 17:16:00 185
springBoot-mybatis-redis 整合解决乱码问题.rar
2020-08-19
SpringBootAndMybatis.rar
2020-07-30
springboot-jdbctemplete.rar
2020-07-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人