摘要: Spring注解配置从 Spring 2.5 开始就可以使用注解来配置依赖注入。使用注解的方式使我们无需在XML中配置一个Bean引用,更加简单和方便。 注解配置默认情况下在Spring中是关闭的,我们需要在配置文件中使用<context:annotation-config/>激活它。 <?xml 阅读全文
posted @ 2021-12-01 13:58 somky 阅读(398) 评论(0) 推荐(0)
摘要: id的三种算法: 1:简单的自增 2:UUID 3:雪花算法 类名:SnowFlake 使用雪花算法的时候会产生前后端交互long类型丢失问题 方法一: @JsonSerialize(using= ToStringSerializer.class)private Long id; 方法二: impo 阅读全文
posted @ 2021-11-17 15:13 somky 阅读(557) 评论(0) 推荐(0)
摘要: <!-- pagehelper 插件--><dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.13</ve 阅读全文
posted @ 2021-11-17 14:35 somky 阅读(52) 评论(0) 推荐(0)
摘要: 作用:也是用来打印接口耗时 类名:LoginInterceptor /** * 拦截器:Spring框架特有的,常用于登录校验,权限校验,请求日志打印 */@Componentpublic class LoginInterceptor implements HandlerInterceptor { 阅读全文
posted @ 2021-11-17 12:37 somky 阅读(125) 评论(0) 推荐(0)