摘要: Spring Security记住我功能实现及源码分析 原创2021-04-07 08:30·FastCoder 环境:Spring Boot 2.2.11.RELEASE 请先阅读《Spring Boot Security防重登录及在线总数 》,《Springboot Security 基础应用 阅读全文
posted @ 2021-08-07 07:19 FastCoder 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 环境:springboot2.2.11.RELEASE+MySQL+JPA+MyBatis 这里不使用第三方的,比如:mycat,sharedsphere。 自己实现一个比较简单的方案。 实现方案:利用AOP拦截业务方法,比如:find,select,query等这类的方法通过从(读)库获取数据,其 阅读全文
posted @ 2021-07-27 09:16 FastCoder 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 环境:spring5.2.15 @Autowried注解首先根据byType注入,如果有多个的情况会按照byName注入,如果没有符合的名称那么系统将会报错。结合@Qualifier限定注入的Bean。 功能1 As of Spring Framework 4.3, an @Autowired an 阅读全文
posted @ 2021-07-23 13:58 FastCoder 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 环境:Java8 Future基本应用 Future是从JDK1.5开始有的,目的是获取异步任务执行的结果,通常情况会结合ExecutorService及Callable一起使用。 1、Future结合Callable使用 单任务执行 private static class Task implem 阅读全文
posted @ 2021-07-19 09:16 FastCoder 阅读(337) 评论(0) 推荐(0) 编辑
摘要: 计划任务之ScheduledExecutorService 在讲ScheduledExecutorService之前先来看看另外一个定时任务Timer的使用 定时任务Timer Timer类能够设置定时任务的相应方法不多,并且不够灵活,在高并发场景下效率不高。 这里以周期执行任务方法为例来看Time 阅读全文
posted @ 2021-07-16 08:52 FastCoder 阅读(773) 评论(0) 推荐(0) 编辑
摘要: 环境:springboot2.3.9.RELEASE 三种方法说明 直接导入普通数组的方式 导入ImportSelector类方式 导入ImportBeanDefinitionRegistrar方式 被导入的类加入到Spring IOC容器中。 直接导入普通数组的方式 public class A 阅读全文
posted @ 2021-07-15 09:51 FastCoder 阅读(397) 评论(0) 推荐(0) 编辑
摘要: 环境:spring cloud context2.2.8.RELEASE + spring boot 2.3.9.RELEASE 1 RefreshScope源码 @Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(Retenti 阅读全文
posted @ 2021-07-14 08:53 FastCoder 阅读(3537) 评论(0) 推荐(1) 编辑
摘要: 环境:springboot2.3.9.RELEASE Spring提供两种编程式事务管理方法: 使用TransactionTemplate 或 TransactionalOperator 直接创建TransactionManager的实现 Spring官方推荐使用TransactionTemplat 阅读全文
posted @ 2021-07-13 09:01 FastCoder 阅读(7124) 评论(1) 推荐(0) 编辑
摘要: 环境:springboot2.3.10 一般使用在项目中使用@Qualifier来限定注入的Bean。 由于项目中我习惯用@Resource注解,所以这里先对@Autowired和@Resource进行个简单的说明。 @Autowired和@Resource区别 相同点: @Autowired与@R 阅读全文
posted @ 2021-07-12 08:56 FastCoder 阅读(1153) 评论(0) 推荐(0) 编辑
摘要: 环境:springboot2.3.10 演示类 JavaBean public class User { private Integer id ; private String name ; public User(Integer id, String name) { this.id = id; t 阅读全文
posted @ 2021-07-11 07:24 FastCoder 阅读(513) 评论(0) 推荐(0) 编辑