<feed xmlns="http://www.w3.org/2005/Atom"> <id>https://whitedg.github.io/</id><title>White</title><subtitle>White's blog.</subtitle> <updated>2024-05-17T17:52:18+08:00</updated> <author> <name>White</name> <uri>https://whitedg.github.io/</uri> </author><link rel="self" type="application/atom+xml" href="https://whitedg.github.io/feed.xml"/><link rel="alternate" type="text/html" hreflang="zh-CN" href="https://whitedg.github.io/"/> <generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator> <rights> © 2024 White </rights> <icon>/assets/img/favicons/favicon.ico</icon> <logo>/assets/img/favicons/favicon-96x96.png</logo> <entry><title>基于 MyBatis 插件实现字段加解密</title><link href="https://whitedg.github.io/posts/%E5%9F%BA%E4%BA%8E-MyBatis-%E6%8F%92%E4%BB%B6%E5%AE%9E%E7%8E%B0%E5%AD%97%E6%AE%B5%E5%8A%A0%E8%A7%A3%E5%AF%86/" rel="alternate" type="text/html" title="基于 MyBatis 插件实现字段加解密" /><published>2022-07-09T00:00:00+08:00</published> <updated>2024-05-15T14:38:42+08:00</updated> <id>https://whitedg.github.io/posts/%E5%9F%BA%E4%BA%8E-MyBatis-%E6%8F%92%E4%BB%B6%E5%AE%9E%E7%8E%B0%E5%AD%97%E6%AE%B5%E5%8A%A0%E8%A7%A3%E5%AF%86/</id> <content src="https://whitedg.github.io/posts/%E5%9F%BA%E4%BA%8E-MyBatis-%E6%8F%92%E4%BB%B6%E5%AE%9E%E7%8E%B0%E5%AD%97%E6%AE%B5%E5%8A%A0%E8%A7%A3%E5%AF%86/" /> <author> <name>White</name> </author> <category term="Java" /> <summary>前言 对于大多数系统来说，敏感数据的加密存储都是必须考虑和实现的。最近在公司的项目中也接到了相关的安全需求，因为项目使用了 MyBatis 作为数据库持久层框架，在经过一番调研后决定使用其插件机制来实现字段加解密功能，并且封装成一个轻量级、支持配置、方便扩展的组件提供给其他项目使用。 MyBatis 的插件机制 关于 MyBatis 插件的详细说明可以查阅官方文档 简介 MyBatis 提供了插件功能，它允许你拦截 MyBatis 执行过程中的某个方法，对其增加自定义操作。默认情况下，MyBatis 允许拦截的方法包括： 类 方法 说明 org.apache.ibatis.executor.Executor update, query, flushStatements, com...</summary> </entry> <entry><title>OAuth 2.0 简单介绍</title><link href="https://whitedg.github.io/posts/OAuth-2.0-%E7%AE%80%E5%8D%95%E4%BB%8B%E7%BB%8D/" rel="alternate" type="text/html" title="OAuth 2.0 简单介绍" /><published>2021-10-24T00:00:00+08:00</published> <updated>2024-05-17T17:51:48+08:00</updated> <id>https://whitedg.github.io/posts/OAuth-2.0-%E7%AE%80%E5%8D%95%E4%BB%8B%E7%BB%8D/</id> <content src="https://whitedg.github.io/posts/OAuth-2.0-%E7%AE%80%E5%8D%95%E4%BB%8B%E7%BB%8D/" /> <author> <name>White</name> </author> <category term="教程" /> <summary>是什么 OAuth 2.0 是目前互联网上非常流行的一种授权机制，它的工作原理是将用户身份验证委托给托管用户帐户的服务并授权第三方应用程序访问该用户帐户。在几乎所有主流的大型互联网产品中都有应用。例如，在登录掘金时，可以选择微博、微信或者 Github 这些第三方账号登录，这里的第三方登录使用的就是 OAuth 2.0 的授权机制。 角色 在 OAuth 标准中，定义了以下四个角色： Resource Owner: 资源拥有者，即用户 Client: 想要获取用户信息的客户端(第三方应用)，获取用户信息前必须经过用户授权 Resource Server: 存放用户信息的资源服务器 Authorization Server: 签发以及验证 token 的授权服务器 实际应用场景中，一般 Resource Server 和 Authorization Serv...</summary> </entry> <entry><title>Redis 实现分布式锁</title><link href="https://whitedg.github.io/posts/Redis-%E5%AE%9E%E7%8E%B0%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81/" rel="alternate" type="text/html" title="Redis 实现分布式锁" /><published>2020-08-09T00:00:00+08:00</published> <updated>2024-05-15T14:38:42+08:00</updated> <id>https://whitedg.github.io/posts/Redis-%E5%AE%9E%E7%8E%B0%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81/</id> <content src="https://whitedg.github.io/posts/Redis-%E5%AE%9E%E7%8E%B0%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81/" /> <author> <name>White</name> </author> <category term="Java" /> <summary>背景 在单机环境下，Java 中的 synchronized 关键字和 ReentrantLock 可重入锁可以满足我们在并发场景下对锁的需求。但是在单机环境满足不了业务需求的情况下，我们一般会选择分布式部署服务，在分布式环境下，synchronized 和 ReentrantLock 的加锁方法已经失效了，因为它们是本地锁，只能在单个服务内实现锁的功能，于是分布式锁就出现了。 分布式锁场景 避免重复的工作 例如我们有一个定时任务会每天检查用户未支付的订单然后发送短信提醒用户支付，多个实例同时运行着这个任务，如果不做加锁处理，那么就会导致发出了多条相同的信息。 保证数据的正确性 在高并发情况下，如果多个实例同时操作一份资源，就有可能会导致这个资源的最终状态出现异常。例如电商平台的抢购场景，大量用户同时下单，如果不做加锁处理，那么很容易导致最终库存信息异常，发生超卖。 Re...</summary> </entry> <entry><title>Jmeter 实用技巧</title><link href="https://whitedg.github.io/posts/Jmeter-%E5%AE%9E%E7%94%A8%E6%8A%80%E5%B7%A7/" rel="alternate" type="text/html" title="Jmeter 实用技巧" /><published>2020-03-27T00:00:00+08:00</published> <updated>2024-05-17T17:51:48+08:00</updated> <id>https://whitedg.github.io/posts/Jmeter-%E5%AE%9E%E7%94%A8%E6%8A%80%E5%B7%A7/</id> <content src="https://whitedg.github.io/posts/Jmeter-%E5%AE%9E%E7%94%A8%E6%8A%80%E5%B7%A7/" /> <author> <name>White</name> </author> <category term="教程" /> <summary>最近使用 jmeter 做了部分压测的工作，记录一下在压测过程中使用到的一些有用的方法和技巧。 随机 自带函数 ${__Random(,,)} 生成指定范围内的随机数 例如：${__Random(1,100,num) 会生成 1-100 之间的随机数，存到变量num ${__RandomDate(,,,,)} 生成指定范围的随机日期 例如：${__RandomDate(yyyy-MM-dd,2019-12-12,2020-12-12,,date)} 会生成 2019-12-12 ~ 2020-12-12 之间的随机日期，存到变量 date ${__RandomFromMultipleVars(,)} 从指定的变量中随机获取一个 例如：${__RandomFromMultipleVars(a|b|c,random_var)} 会从 a/b/c 三个变量中随机取一个，...</summary> </entry> <entry><title>Spring Boot Actuator</title><link href="https://whitedg.github.io/posts/Spring-Boot-Actuator/" rel="alternate" type="text/html" title="Spring Boot Actuator" /><published>2020-01-15T00:00:00+08:00</published> <updated>2024-05-15T14:38:42+08:00</updated> <id>https://whitedg.github.io/posts/Spring-Boot-Actuator/</id> <content src="https://whitedg.github.io/posts/Spring-Boot-Actuator/" /> <author> <name>White</name> </author> <category term="Java" /> <summary>简介 spring-boot-starter-actuator 是一个用于监控和管理 Spring Boot 应用的组件。使用 spring-boot-starter-actuator 之后，我们可以非常方便的通过 HTTP 接口或者 JMX 获取到服务的运行状态，依赖的数据库状态，JVM 的运行状态，搜集指标等等，从而实现对服务的监控和管理。配合 prometheus 和 grafana 可以快速的实现监控数据可视化。 使用方式 添加依赖 &amp;amp;lt;dependency&amp;amp;gt; &amp;amp;lt;groupId&amp;amp;gt;org.springframework.boot&amp;amp;lt;/groupId&amp;amp;gt; &amp;amp;lt;artifactId&amp;amp;gt;spring-boot-starter-actuator&amp;amp;lt;/artifactId&amp;amp;gt; &amp;amp;lt;/dependency&amp;amp;gt; A...</summary> </entry> </feed>
