{"id":68029,"date":"2026-01-29T15:57:14","date_gmt":"2026-01-29T07:57:14","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/68029.html"},"modified":"2026-01-29T15:57:14","modified_gmt":"2026-01-29T07:57:14","slug":"%e6%89%8b%e6%8a%8a%e6%89%8b%e6%95%99%e4%bd%a0%e5%ae%9e%e7%8e%b0%e4%b8%80%e4%b8%aa%e9%98%b2%e9%87%8d%e5%a4%8d%e6%8f%90%e4%ba%a4%e6%b3%a8%e8%a7%a3%ef%bc%88spring-boot-redis-%e5%ae%9e%e6%88%98%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/68029.html","title":{"rendered":"\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09"},"content":{"rendered":"<h2><\/h2>\n<p>\u89c6\u9891\u770b\u4e86\u51e0\u767e\u5c0f\u65f6\u8fd8\u8ff7\u7cca&#xff1f;\u5173\u6ce8\u6211&#xff0c;\u51e0\u5206\u949f\u8ba9\u4f60\u79d2\u61c2&#xff01;<\/p>\n<hr \/>\n<h3>&#x1f9e9; \u4e00\u3001\u4e3a\u4ec0\u4e48\u9700\u8981\u9632\u91cd\u590d\u63d0\u4ea4&#xff1f;<\/h3>\n<p>\u7528\u6237\u5728\u4ee5\u4e0b\u573a\u666f\u5bb9\u6613\u591a\u6b21\u70b9\u51fb&#xff1a;<\/p>\n<ul>\n<li>\u63d0\u4ea4\u8ba2\u5355&#xff08;\u6015\u6ca1\u6210\u529f&#xff0c;\u72c2\u70b9\u201c\u652f\u4ed8\u201d&#xff09;&#xff1b;<\/li>\n<li>\u53d1\u9001\u77ed\u4fe1\u9a8c\u8bc1\u7801&#xff08;\u70b9\u4e00\u6b21\u6ca1\u53cd\u5e94&#xff0c;\u518d\u70b9&#xff09;&#xff1b;<\/li>\n<li>\u8868\u5355\u4fdd\u5b58&#xff08;\u7f51\u7edc\u6162&#xff0c;\u4ee5\u4e3a\u6ca1\u63d0\u4ea4&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u540e\u679c\u5f88\u4e25\u91cd&#xff1a;<\/p>\n<ul>\n<li>\u8ba2\u5355\u91cd\u590d\u521b\u5efa \u2192 \u5e93\u5b58\u8d85\u5356\u3001\u8d22\u52a1\u5bf9\u4e0d\u4e0a&#xff1b;<\/li>\n<li>\u77ed\u4fe1\u8f70\u70b8 \u2192 \u88ab\u8fd0\u8425\u5546\u5c01\u53f7\u3001\u7528\u6237\u6295\u8bc9&#xff1b;<\/li>\n<li>\u6570\u636e\u91cd\u590d\u63d2\u5165 \u2192 \u6570\u636e\u5e93\u810f\u6570\u636e\u3002<\/li>\n<\/ul>\n<p>\u2705 \u76ee\u6807&#xff1a;\u540c\u4e00\u4e2a\u7528\u6237&#xff0c;\u5728\u77ed\u65f6\u95f4\u5185&#xff0c;\u5bf9\u540c\u4e00\u63a5\u53e3\u53ea\u80fd\u63d0\u4ea4\u4e00\u6b21&#xff01;<\/p>\n<hr \/>\n<h3>&#x1f510; \u4e8c\u3001\u8bbe\u8ba1\u601d\u8def&#xff1a;\u57fa\u4e8e Token &#043; Redis<\/h3>\n<p>\u6211\u4eec\u91c7\u7528 \u201c\u8bf7\u6c42\u552f\u4e00\u6807\u8bc6 &#043; \u5206\u5e03\u5f0f\u9501\u201d \u65b9\u6848&#xff1a;<\/p>\n<li>\u524d\u7aef\u8fdb\u5165\u9875\u9762\u65f6&#xff0c;\u5148\u8bf7\u6c42 \/get-token \u83b7\u53d6\u4e00\u4e2a\u552f\u4e00 token&#xff1b;<\/li>\n<li>\u63d0\u4ea4\u8868\u5355\u65f6&#xff0c;\u5e26\u4e0a\u8fd9\u4e2a token&#xff1b;<\/li>\n<li>\u540e\u7aef\u7528 &#064;PreventDuplicateSubmit \u6ce8\u89e3\u62e6\u622a&#xff1a;\n<ul>\n<li>\u5982\u679c token \u4e0d\u5b58\u5728 or \u5df2\u4f7f\u7528 \u2192 \u62d2\u7edd&#xff1b;<\/li>\n<li>\u5982\u679c token \u6709\u6548 \u2192 \u653e\u884c&#xff0c;\u5e76\u7acb\u5373\u5220\u9664 token&#xff08;\u9632\u6b62\u91cd\u7528&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<p>&#x1f4a1; \u4e3a\u4ec0\u4e48\u4e0d\u7528 IP &#043; URL &#043; \u53c2\u6570\u505a key&#xff1f;<\/p>\n<ul>\n<li>\u7528\u6237\u53ef\u80fd\u5207\u6362\u7f51\u7edc&#xff08;IP \u53d8&#xff09;&#xff1b;<\/li>\n<li>\u53c2\u6570\u53ef\u80fd\u542b\u65f6\u95f4\u6233&#xff08;\u6bcf\u6b21\u4e0d\u540c&#xff09;&#xff1b;<\/li>\n<li>Token \u673a\u5236\u66f4\u7cbe\u51c6\u3001\u53ef\u63a7&#xff01;<\/li>\n<\/ul>\n<hr \/>\n<h3>&#x1f6e0;\ufe0f \u4e09\u3001\u5b8c\u6574\u5b9e\u73b0&#xff08;Spring Boot &#043; Redis&#xff09;<\/h3>\n<h4>1. \u6dfb\u52a0\u4f9d\u8d56<\/h4>\n<p>&lt;dependency&gt;<br \/>\n    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;<br \/>\n&lt;\/dependency&gt;<br \/>\n&lt;dependency&gt;<br \/>\n    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;spring-boot-starter-data-redis&lt;\/artifactId&gt;<br \/>\n&lt;\/dependency&gt;<br \/>\n&lt;dependency&gt;<br \/>\n    &lt;groupId&gt;org.apache.commons&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;commons-pool2&lt;\/artifactId&gt; &lt;!&#8211; \u8fde\u63a5\u6c60 &#8211;&gt;<br \/>\n&lt;\/dependency&gt;<\/p>\n<h4>2. \u81ea\u5b9a\u4e49\u6ce8\u89e3<\/h4>\n<p>import java.lang.annotation.ElementType;<br \/>\nimport java.lang.annotation.Retention;<br \/>\nimport java.lang.annotation.RetentionPolicy;<br \/>\nimport java.lang.annotation.Target;<\/p>\n<p>&#064;Target(ElementType.METHOD)<br \/>\n&#064;Retention(RetentionPolicy.RUNTIME)<br \/>\npublic &#064;interface PreventDuplicateSubmit {<br \/>\n    \/**<br \/>\n     * \u6709\u6548\u671f&#xff08;\u79d2&#xff09;&#xff0c;\u9ed8\u8ba4 10 \u79d2<br \/>\n     *\/<br \/>\n    int expire() default 10;<br \/>\n}<\/p>\n<h4>3. \u5168\u5c40\u5f02\u5e38&#xff08;\u7528\u4e8e\u63d0\u793a\u91cd\u590d\u63d0\u4ea4&#xff09;<\/h4>\n<p>public class DuplicateSubmitException extends RuntimeException {<br \/>\n    public DuplicateSubmitException(String message) {<br \/>\n        super(message);<br \/>\n    }<br \/>\n}<\/p>\n<h4>4. AOP \u5207\u9762\u5b9e\u73b0\u6838\u5fc3\u903b\u8f91<\/h4>\n<p>import org.aspectj.lang.ProceedingJoinPoint;<br \/>\nimport org.aspectj.lang.annotation.Around;<br \/>\nimport org.aspectj.lang.annotation.Aspect;<br \/>\nimport org.springframework.beans.factory.annotation.Autowired;<br \/>\nimport org.springframework.data.redis.core.StringRedisTemplate;<br \/>\nimport org.springframework.stereotype.Component;<br \/>\nimport org.springframework.web.context.request.RequestContextHolder;<br \/>\nimport org.springframework.web.context.request.ServletRequestAttributes;<\/p>\n<p>import javax.servlet.http.HttpServletRequest;<br \/>\nimport java.util.concurrent.TimeUnit;<\/p>\n<p>&#064;Aspect<br \/>\n&#064;Component<br \/>\npublic class PreventDuplicateSubmitAspect {<\/p>\n<p>    &#064;Autowired<br \/>\n    private StringRedisTemplate redisTemplate;<\/p>\n<p>    &#064;Around(&#034;&#064;annotation(prevent)&#034;)<br \/>\n    public Object around(ProceedingJoinPoint joinPoint, PreventDuplicateSubmit prevent) throws Throwable {<br \/>\n        HttpServletRequest request &#061; ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();<\/p>\n<p>        \/\/ 1. \u4ece header \u6216\u53c2\u6570\u4e2d\u83b7\u53d6 token<br \/>\n        String token &#061; request.getHeader(&#034;X-Submit-Token&#034;);<br \/>\n        if (token &#061;&#061; null || token.trim().isEmpty()) {<br \/>\n            throw new DuplicateSubmitException(&#034;\u7f3a\u5c11\u9632\u91cd\u63d0\u4ea4\u4ee4\u724c&#034;);<br \/>\n        }<\/p>\n<p>        \/\/ 2. \u6784\u5efa Redis Key&#xff08;\u5efa\u8bae\u52a0\u4e0a\u7528\u6237\u6807\u8bc6&#xff0c;\u9632\u6b62\u8de8\u7528\u6237\u653b\u51fb&#xff09;<br \/>\n        String userId &#061; getCurrentUserId(request); \/\/ \u4f2a\u4ee3\u7801&#xff0c;\u5b9e\u9645\u4ece token\/session \u83b7\u53d6<br \/>\n        String redisKey &#061; &#034;submit:token:&#034; &#043; userId &#043; &#034;:&#034; &#043; token;<\/p>\n<p>        \/\/ 3. \u5c1d\u8bd5\u83b7\u53d6\u5e76\u5220\u9664 token&#xff08;\u539f\u5b50\u64cd\u4f5c&#xff09;<br \/>\n        Boolean exists &#061; redisTemplate.opsForValue().setIfAbsent(redisKey, &#034;used&#034;, prevent.expire(), TimeUnit.SECONDS);<br \/>\n        if (Boolean.FALSE.equals(exists)) {<br \/>\n            \/\/ token \u4e0d\u5b58\u5728\u6216\u5df2\u4f7f\u7528<br \/>\n            throw new DuplicateSubmitException(&#034;\u8bf7\u52ff\u91cd\u590d\u63d0\u4ea4&#034;);<br \/>\n        }<\/p>\n<p>        \/\/ 4. \u653e\u884c<br \/>\n        return joinPoint.proceed();<br \/>\n    }<\/p>\n<p>    \/\/ \u4f2a\u4ee3\u7801&#xff1a;\u83b7\u53d6\u5f53\u524d\u7528\u6237 ID&#xff08;\u6839\u636e\u4f60\u7684\u8ba4\u8bc1\u4f53\u7cfb\u8c03\u6574&#xff09;<br \/>\n    private String getCurrentUserId(HttpServletRequest request) {<br \/>\n        \/\/ \u793a\u4f8b&#xff1a;\u4ece JWT \u6216 Session \u4e2d\u83b7\u53d6<br \/>\n        \/\/ return (String) request.getSession().getAttribute(&#034;userId&#034;);<br \/>\n        return &#034;user_123&#034;; \/\/ \u4ec5\u7528\u4e8e\u6f14\u793a<br \/>\n    }<br \/>\n}<\/p>\n<p>&#x1f511; \u5173\u952e\u70b9&#xff1a;<\/p>\n<ul>\n<li>setIfAbsent &#061; SETNX&#xff0c;\u539f\u5b50\u6027\u4fdd\u8bc1\u7ebf\u7a0b\u5b89\u5168&#xff1b;<\/li>\n<li>token \u4f7f\u7528\u540e\u7acb\u5373\u5931\u6548&#xff08;\u5373\u4f7f expire&#061;10s&#xff0c;\u4e5f\u53ea\u5141\u8bb8\u7528\u4e00\u6b21&#xff09;&#xff1b;<\/li>\n<li>key \u4e2d\u5305\u542b userId&#xff0c;\u907f\u514d A \u7528\u6237\u7684 token \u88ab B \u7528\u6237\u4f7f\u7528\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>&#x1f9ea; \u56db\u3001\u524d\u7aef\u914d\u5408\u6d41\u7a0b<\/h3>\n<h4>1. \u8fdb\u5165\u9875\u9762\u65f6\u83b7\u53d6 token<\/h4>\n<p>\/\/ \u9875\u9762\u52a0\u8f7d\u65f6<br \/>\nfetch(&#039;\/api\/submit-token&#039;)<br \/>\n  .then(res &#061;&gt; res.json())<br \/>\n  .then(data &#061;&gt; {<br \/>\n      localStorage.setItem(&#039;submitToken&#039;, data.token);<br \/>\n  });<\/p>\n<h4>2. \u63d0\u4ea4\u65f6\u5e26\u4e0a token<\/h4>\n<p>const token &#061; localStorage.getItem(&#039;submitToken&#039;);<br \/>\nfetch(&#039;\/api\/order\/create&#039;, {<br \/>\n    method: &#039;POST&#039;,<br \/>\n    headers: {<br \/>\n        &#039;Content-Type&#039;: &#039;application\/json&#039;,<br \/>\n        &#039;X-Submit-Token&#039;: token  \/\/ &#x1f448; \u5173\u952e&#xff01;<br \/>\n    },<br \/>\n    body: JSON.stringify(orderData)<br \/>\n})<br \/>\n.then(res &#061;&gt; {<br \/>\n    if (res.ok) {<br \/>\n        \/\/ \u6210\u529f\u540e\u6e05\u7a7a token&#xff0c;\u9632\u6b62\u518d\u6b21\u4f7f\u7528<br \/>\n        localStorage.removeItem(&#039;submitToken&#039;);<br \/>\n    }<br \/>\n});<\/p>\n<hr \/>\n<h3>\u2699\ufe0f \u4e94\u3001\u63d0\u4f9b\u83b7\u53d6 token \u7684\u63a5\u53e3<\/h3>\n<p>&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/api&#034;)<br \/>\npublic class SubmitTokenController {<\/p>\n<p>    &#064;Autowired<br \/>\n    private StringRedisTemplate redisTemplate;<\/p>\n<p>    &#064;GetMapping(&#034;\/submit-token&#034;)<br \/>\n    public Map&lt;String, String&gt; getSubmitToken() {<br \/>\n        String token &#061; java.util.UUID.randomUUID().toString().replace(&#034;-&#034;, &#034;&#034;);<br \/>\n        \/\/ \u53ef\u9009&#xff1a;\u9884\u5b58 token&#xff08;\u975e\u5fc5\u987b&#xff0c;\u56e0\u4e3a AOP \u4f1a setIfAbsent&#xff09;<br \/>\n        \/\/ redisTemplate.opsForValue().set(&#034;submit:prepare:&#034; &#043; token, &#034;1&#034;, 60, TimeUnit.SECONDS);<br \/>\n        return Map.of(&#034;token&#034;, token);<br \/>\n    }<br \/>\n}<\/p>\n<p>&#x1f4a1; token \u65e0\u9700\u63d0\u524d\u5b58\u5165 Redis&#xff01;AOP \u4e2d\u7684 setIfAbsent \u4f1a\u81ea\u52a8\u521b\u5efa\u3002<\/p>\n<hr \/>\n<h3>\u274c \u516d\u3001\u53cd\u4f8b &amp; \u5e38\u89c1\u9519\u8bef<\/h3>\n<h4>\u53cd\u4f8b 1&#xff1a;\u7528 session \u5b58 flag&#xff08;\u4e0d\u652f\u6301\u5206\u5e03\u5f0f&#xff09;<\/h4>\n<p>\/\/ \u274c \u5355\u673a\u53ef\u7528&#xff0c;\u96c6\u7fa4\u73af\u5883\u4e0b session \u4e0d\u5171\u4eab&#xff01;<br \/>\nsession.setAttribute(&#034;submitted&#034;, true);<\/p>\n<p>\u2705 \u6b63\u786e&#xff1a;\u5fc5\u987b\u7528 Redis \u7b49\u5206\u5e03\u5f0f\u5b58\u50a8\u3002<\/p>\n<hr \/>\n<h4>\u53cd\u4f8b 2&#xff1a;\u53ea\u6821\u9a8c\u4e0d\u5220\u9664 token<\/h4>\n<p>\/\/ \u274c token 10 \u79d2\u5185\u53ef\u65e0\u9650\u6b21\u4f7f\u7528&#xff01;<br \/>\nif (redis.hasKey(token)) {<br \/>\n    return error;<br \/>\n}<\/p>\n<p>\u2705 \u6b63\u786e&#xff1a;\u4f7f\u7528\u5373\u5931\u6548&#xff08;\u901a\u8fc7 setIfAbsent \u539f\u5b50\u64cd\u4f5c\u5b9e\u73b0&#xff09;\u3002<\/p>\n<hr \/>\n<h4>\u53cd\u4f8b 3&#xff1a;token \u6ca1\u7ed1\u5b9a\u7528\u6237<\/h4>\n<p>String redisKey &#061; &#034;submit:token:&#034; &#043; token; \/\/ \u274c \u4efb\u4f55\u4eba\u90fd\u80fd\u7528\u8fd9\u4e2a token&#xff01;<\/p>\n<p>&#x1f4a5; \u98ce\u9669&#xff1a;\u6076\u610f\u7528\u6237\u83b7\u53d6 token \u540e&#xff0c;\u53ef\u963b\u6b62\u5176\u4ed6\u7528\u6237\u63d0\u4ea4&#xff01;<\/p>\n<p>\u2705 \u6b63\u786e&#xff1a;key \u5fc5\u987b\u5305\u542b\u7528\u6237\u552f\u4e00\u6807\u8bc6\u3002<\/p>\n<hr \/>\n<h3>\u26a0\ufe0f \u4e03\u3001\u6ce8\u610f\u4e8b\u9879 &amp; \u589e\u5f3a\u5efa\u8bae<\/h3>\n<table>\n<tr>\u573a\u666f\u5efa\u8bae<\/tr>\n<tbody>\n<tr>\n<td>Token \u6cc4\u9732<\/td>\n<td>HTTPS \u4f20\u8f93&#xff0c;header \u4e0d\u8981\u5b58\u654f\u611f\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>\u7528\u6237\u4f53\u9a8c<\/td>\n<td>\u524d\u7aef\u63d0\u4ea4\u540e\u7981\u7528\u6309\u94ae&#xff0c;\u907f\u514d\u7528\u6237\u72c2\u70b9<\/td>\n<\/tr>\n<tr>\n<td>\u9ad8\u5e76\u53d1<\/td>\n<td>Redis \u672c\u8eab\u652f\u6301\u9ad8\u5e76\u53d1&#xff0c;SETNX \u662f\u539f\u5b50\u64cd\u4f5c<\/td>\n<\/tr>\n<tr>\n<td>\u964d\u7ea7\u65b9\u6848<\/td>\n<td>Redis \u5b95\u673a\u65f6&#xff0c;\u53ef\u4e34\u65f6\u5173\u95ed\u9632\u91cd&#xff08;\u8bb0\u5f55\u65e5\u5fd7\u544a\u8b66&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u76d1\u63a7<\/td>\n<td>\u7edf\u8ba1\u201c\u91cd\u590d\u63d0\u4ea4\u201d\u6b21\u6570&#xff0c;\u53d1\u73b0\u5f02\u5e38\u884c\u4e3a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>&#x1f3af; \u516b\u3001\u603b\u7ed3&#xff1a;\u9632\u91cd\u63d0\u4ea4\u6838\u5fc3\u6d41\u7a0b<\/h3>\n<p>\u524d\u7aef                          \u540e\u7aef<br \/>\n  \u2502                             \u2502<br \/>\n  \u251c\u25001. GET \/submit-token \u2500\u2500\u2500\u2500\u2192 \u2502<br \/>\n  \u2502 \u2190\u2500\u2500 {token: &#034;abc123&#034;} \u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n  \u2502                             \u2502<br \/>\n  \u251c\u25002. POST \/order (\u5e26 token) \u2192\u2502<br \/>\n  \u2502                             \u251c\u2500 AOP \u62e6\u622a<br \/>\n  \u2502                             \u251c\u2500 \u68c0\u67e5 Redis: submit:token:user123:abc123<br \/>\n  \u2502                             \u251c\u2500 \u4e0d\u5b58\u5728 \u2192 \u62d2\u7edd&#xff08;\u91cd\u590d\u63d0\u4ea4&#xff09;<br \/>\n  \u2502                             \u251c\u2500 \u5b58\u5728 \u2192 \u5220\u9664 &#043; \u653e\u884c<br \/>\n  \u2502 \u2190\u2500\u2500 \u6210\u529f\/\u5931\u8d25 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<\/p>\n<p>\u2705 \u4f18\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u7cbe\u51c6&#xff1a;\u6309\u7528\u6237 &#043; \u63a5\u53e3\u7ea7\u522b\u63a7\u5236&#xff1b;<\/li>\n<li>\u5b89\u5168&#xff1a;token \u4e00\u6b21\u6709\u6548&#xff1b;<\/li>\n<li>\u9ad8\u6548&#xff1a;Redis \u64cd\u4f5c\u5fae\u79d2\u7ea7&#xff1b;<\/li>\n<li>\u901a\u7528&#xff1a;\u901a\u8fc7\u6ce8\u89e3\u4e00\u952e\u5f00\u542f\u3002<\/li>\n<\/ul>\n<hr \/>\n<p>\u89c6\u9891\u770b\u4e86\u51e0\u767e\u5c0f\u65f6\u8fd8\u8ff7\u7cca&#xff1f;\u5173\u6ce8\u6211&#xff0c;\u51e0\u5206\u949f\u8ba9\u4f60\u79d2\u61c2&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89c6\u9891\u770b\u4e86\u51e0\u767e\u5c0f\u65f6\u8fd8\u8ff7\u7cca&#xff1f;\u5173\u6ce8\u6211&#xff0c;\u51e0\u5206\u949f\u8ba9\u4f60\u79d2\u61c2&#xff01;&#x1f9e9; \u4e00\u3001\u4e3a\u4ec0\u4e48\u9700\u8981\u9632\u91cd\u590d\u63d0\u4ea4&#xff1f;\u7528\u6237\u5728\u4ee5\u4e0b\u573a\u666f\u5bb9\u6613\u591a\u6b21\u70b9\u51fb&#xff1a;\u63d0\u4ea4\u8ba2\u5355&#xff08;\u6015\u6ca1\u6210\u529f&#xff0c;\u72c2\u70b9\u201c\u652f\u4ed8\u201d&#xff09;&#xff1b;\u53d1\u9001\u77ed\u4fe1\u9a8c\u8bc1\u7801&#xff08;\u70b9\u4e00\u6b21\u6ca1\u53cd\u5e94&#xff0c;\u518d\u70b9&#xff09;&#xff1b;\u8868\u5355\u4fdd\u5b58&#xff08;\u7f51\u7edc\u6162&#xff0c;\u4ee5\u4e3a\u6ca1\u63d0\u4ea4&#xff09;\u3002\u540e\u679c\u5f88\u4e25\u91cd&#xff1a;\u8ba2<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[98],"topic":[],"class_list":["post-68029","post","type-post","status-publish","format-standard","hentry","category-server","tag-spring-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/68029.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u89c6\u9891\u770b\u4e86\u51e0\u767e\u5c0f\u65f6\u8fd8\u8ff7\u7cca&#xff1f;\u5173\u6ce8\u6211&#xff0c;\u51e0\u5206\u949f\u8ba9\u4f60\u79d2\u61c2&#xff01;&#x1f9e9; \u4e00\u3001\u4e3a\u4ec0\u4e48\u9700\u8981\u9632\u91cd\u590d\u63d0\u4ea4&#xff1f;\u7528\u6237\u5728\u4ee5\u4e0b\u573a\u666f\u5bb9\u6613\u591a\u6b21\u70b9\u51fb&#xff1a;\u63d0\u4ea4\u8ba2\u5355&#xff08;\u6015\u6ca1\u6210\u529f&#xff0c;\u72c2\u70b9\u201c\u652f\u4ed8\u201d&#xff09;&#xff1b;\u53d1\u9001\u77ed\u4fe1\u9a8c\u8bc1\u7801&#xff08;\u70b9\u4e00\u6b21\u6ca1\u53cd\u5e94&#xff0c;\u518d\u70b9&#xff09;&#xff1b;\u8868\u5355\u4fdd\u5b58&#xff08;\u7f51\u7edc\u6162&#xff0c;\u4ee5\u4e3a\u6ca1\u63d0\u4ea4&#xff09;\u3002\u540e\u679c\u5f88\u4e25\u91cd&#xff1a;\u8ba2\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/68029.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-29T07:57:14+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/68029.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/68029.html\",\"name\":\"\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-29T07:57:14+00:00\",\"dateModified\":\"2026-01-29T07:57:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/68029.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/68029.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/68029.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/68029.html","og_locale":"zh_CN","og_type":"article","og_title":"\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u89c6\u9891\u770b\u4e86\u51e0\u767e\u5c0f\u65f6\u8fd8\u8ff7\u7cca&#xff1f;\u5173\u6ce8\u6211&#xff0c;\u51e0\u5206\u949f\u8ba9\u4f60\u79d2\u61c2&#xff01;&#x1f9e9; \u4e00\u3001\u4e3a\u4ec0\u4e48\u9700\u8981\u9632\u91cd\u590d\u63d0\u4ea4&#xff1f;\u7528\u6237\u5728\u4ee5\u4e0b\u573a\u666f\u5bb9\u6613\u591a\u6b21\u70b9\u51fb&#xff1a;\u63d0\u4ea4\u8ba2\u5355&#xff08;\u6015\u6ca1\u6210\u529f&#xff0c;\u72c2\u70b9\u201c\u652f\u4ed8\u201d&#xff09;&#xff1b;\u53d1\u9001\u77ed\u4fe1\u9a8c\u8bc1\u7801&#xff08;\u70b9\u4e00\u6b21\u6ca1\u53cd\u5e94&#xff0c;\u518d\u70b9&#xff09;&#xff1b;\u8868\u5355\u4fdd\u5b58&#xff08;\u7f51\u7edc\u6162&#xff0c;\u4ee5\u4e3a\u6ca1\u63d0\u4ea4&#xff09;\u3002\u540e\u679c\u5f88\u4e25\u91cd&#xff1a;\u8ba2","og_url":"https:\/\/www.wsisp.com\/helps\/68029.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-29T07:57:14+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/68029.html","url":"https:\/\/www.wsisp.com\/helps\/68029.html","name":"\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-29T07:57:14+00:00","dateModified":"2026-01-29T07:57:14+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/68029.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/68029.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/68029.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0\u4e00\u4e2a\u9632\u91cd\u590d\u63d0\u4ea4\u6ce8\u89e3\uff08Spring Boot + Redis \u5b9e\u6218\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/68029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=68029"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/68029\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=68029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=68029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=68029"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=68029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}