摘要: UserThreadLocal类编写 用于存放数据、获取数据、删除数据 import com.he.blogapi.pojo.SysUser; public class UserThreadLocal { private UserThreadLocal(){} private static fina 阅读全文
posted @ 2022-09-12 14:27 Homnay 阅读(91) 评论(0) 推荐(0)
摘要: 引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> 注入StringRedisTempl 阅读全文
posted @ 2022-09-11 16:44 Homnay 阅读(27) 评论(0) 推荐(0)
摘要: JWT技术概念: 登录使用JWT技术。 jwt 可以生成 一个加密的token,做为用户登录的令牌,当用户登录成功之后,发放给客户端。 请求需要登录的资源或者接口的时候,将token携带,后端验证token是否合法。 jwt 有三部分组成:A.B.C A:Header,{"type":"JWT"," 阅读全文
posted @ 2022-09-11 15:15 Homnay 阅读(59) 评论(0) 推荐(0)
摘要: public enum ErrorCode { PARAMS_ERROR(10001,"参数有误"), ACCOUNT_PWD_NOT_EXIST(10002,"用户名或密码不存在"), NO_PERMISSION(70001,"无访问权限"), SESSION_TIME_OUT(90001,"会话 阅读全文
posted @ 2022-09-11 14:32 Homnay 阅读(39) 评论(0) 推荐(0)
摘要: 代码 @ControllerAdvice 全局异常处理注解 @ExceptionHandler(Exception.class) 捕获异常并进行处理 @ControllerAdvice public class AllExceptionHandler { @ExceptionHandler(Exce 阅读全文
posted @ 2022-09-11 10:55 Homnay 阅读(24) 评论(0) 推荐(0)
摘要: spring.application.name:指定应用的名称,,在spring cloud中被用来注册的服务名 spring: application: name: blog_he server.port:配置服务器端口 server: port: 8888 数据库连接配置 spring: dat 阅读全文
posted @ 2022-09-10 18:14 Homnay 阅读(85) 评论(0) 推荐(0)
摘要: 分页插件配置 @Configuration public class MybatisPlusConfig { @Bean public MybatisPlusInterceptor MybatisPlusInterceptor(){ MybatisPlusInterceptor intercepto 阅读全文
posted @ 2022-09-10 18:13 Homnay 阅读(19) 评论(0) 推荐(0)
摘要: 引入pom依赖 <!-- 引入redis --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <exclusions> 阅读全文
posted @ 2022-09-09 18:03 Homnay 阅读(24) 评论(0) 推荐(0)
摘要: 一、防火墙的开启、关闭、禁用命令 (1)设置开机启用防火墙:systemctl enable firewalld.service (2)设置开机禁用防火墙:systemctl disable firewalld.service (3)启动防火墙:systemctl start firewalld ( 阅读全文
posted @ 2022-09-09 16:19 Homnay 阅读(89) 评论(0) 推荐(0)
摘要: Redis服务启动命令参数代表意义 启动六台Redis服务器 docker run -d --name redis-node-1 --net host --privileged=true -v /data/redis/share/redis-node-1:/data redis --cluster- 阅读全文
posted @ 2022-09-09 09:21 Homnay 阅读(25) 评论(0) 推荐(0)