Deploying to pages from @ Charles7c/charles7c.github.io@dc5e159616 🚀
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as g}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as c,D as p,o as k,c as o,k as s,a as i,I as a,w as y,R as e,b as A,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const W=JSON.parse('{"title":"个人 SQL 优化技巧","description":"","frontmatter":{"title":"个人 SQL 优化技巧","author":"查尔斯","date":"2019/12/28 10:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["SQL","SQL优化"]},"headers":[],"relativePath":"categories/fragments/2019/12/28/个人SQL优化技巧.md","filePath":"categories/fragments/2019/12/28/个人SQL优化技巧.md","lastUpdated":1671423875000}'),_={name:"categories/fragments/2019/12/28/个人SQL优化技巧.md"},D={id:"个人-sql-优化技巧",tabindex:"-1"},C=s("a",{class:"header-anchor",href:"#个人-sql-优化技巧","aria-label":'Permalink to "个人 SQL 优化技巧 <Badge text="持续更新" type="warning" />"'},"",-1),b=s("h2",{id:"查询优化",tabindex:"-1"},[i("查询优化 "),s("a",{class:"header-anchor",href:"#查询优化","aria-label":'Permalink to "查询优化"'},"")],-1),u={id:"如果确定结果只有一条-使用-limit-1",tabindex:"-1"},E=s("a",{class:"header-anchor",href:"#如果确定结果只有一条-使用-limit-1","aria-label":'Permalink to "如果确定结果只有一条,使用 LIMIT 1 <Badge text="建议" />"'},"",-1),m=e("",3),v={id:"避免隐式类型转换",tabindex:"-1"},B=s("a",{class:"header-anchor",href:"#避免隐式类型转换","aria-label":'Permalink to "避免隐式类型转换 <Badge text="强制" type="danger" />"'},"",-1),T=e("",3),f={id:"列名带上前缀",tabindex:"-1"},N=s("a",{class:"header-anchor",href:"#列名带上前缀","aria-label":'Permalink to "列名带上前缀 <Badge text="建议" />"'},"",-1),I=e("",2),x={id:"非负数列添加unsigned无符号约束",tabindex:"-1"},S=s("a",{class:"header-anchor",href:"#非负数列添加unsigned无符号约束","aria-label":'Permalink to "非负数列添加UNSIGNED无符号约束 <Badge text="建议" />"'},"",-1),L=e("",2),M={id:"合理采用整数类型",tabindex:"-1"},P=s("a",{class:"header-anchor",href:"#合理采用整数类型","aria-label":'Permalink to "合理采用整数类型 <Badge text="建议" />"'},"",-1),O=e("",3),R={id:"布尔列采用bit类型",tabindex:"-1"},U=s("a",{class:"header-anchor",href:"#布尔列采用bit类型","aria-label":'Permalink to "布尔列采用bit类型 <Badge text="建议" />"'},"",-1),q=e("",3),Q={id:"采用utf8mb4编码",tabindex:"-1"},V=s("a",{class:"header-anchor",href:"#采用utf8mb4编码","aria-label":'Permalink to "采用utf8mb4编码 <Badge text="建议" />"'},"",-1),Y=e("",1);function G(l,Z,X,$,J,j){const t=p("Badge"),d=g,r=p("ClientOnly");return k(),o("div",null,[s("h1",D,[i("个人 SQL 优化技巧 "),a(t,{text:"持续更新",type:"warning"}),i(),C]),a(r,null,{default:y(()=>{var n,h;return[(((n=l.$frontmatter)==null?void 0:n.aside)??!0)&&(((h=l.$frontmatter)==null?void 0:h.showArticleMetadata)??!0)?(k(),A(d,{key:0,article:l.$frontmatter},null,8,["article"])):F("",!0)]}),_:1}),b,s("h3",u,[i("如果确定结果只有一条,使用 LIMIT 1 "),a(t,{text:"建议"}),i(),E]),m,s("h3",v,[i("避免隐式类型转换 "),a(t,{text:"强制",type:"danger"}),i(),B]),T,s("h3",f,[i("列名带上前缀 "),a(t,{text:"建议"}),i(),N]),I,s("h3",x,[i("非负数列添加UNSIGNED无符号约束 "),a(t,{text:"建议"}),i(),S]),L,s("h3",M,[i("合理采用整数类型 "),a(t,{text:"建议"}),i(),P]),O,s("h3",R,[i("布尔列采用bit类型 "),a(t,{text:"建议"}),i(),U]),q,s("h3",Q,[i("采用utf8mb4编码 "),a(t,{text:"建议"}),i(),V]),Y])}const z=c(_,[["render",G]]);export{W as __pageData,z as default};
|
||||
import{_ as c}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as g,D as p,o as k,c as o,k as s,a as i,I as a,w as y,R as e,b as A,e as _}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const X=JSON.parse('{"title":"个人 SQL 优化技巧","description":"","frontmatter":{"title":"个人 SQL 优化技巧","author":"查尔斯","date":"2019/12/28 10:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["SQL","SQL优化"]},"headers":[],"relativePath":"categories/fragments/2019/12/28/个人SQL优化技巧.md","filePath":"categories/fragments/2019/12/28/个人SQL优化技巧.md","lastUpdated":1671423875000}'),F={name:"categories/fragments/2019/12/28/个人SQL优化技巧.md"},D={id:"个人-sql-优化技巧",tabindex:"-1"},C=s("a",{class:"header-anchor",href:"#个人-sql-优化技巧","aria-label":'Permalink to "个人 SQL 优化技巧 <Badge text="持续更新" type="warning" />"'},"",-1),E=s("h2",{id:"查询优化",tabindex:"-1"},[i("查询优化 "),s("a",{class:"header-anchor",href:"#查询优化","aria-label":'Permalink to "查询优化"'},"")],-1),b={id:"如果确定结果只有一条-使用-limit-1",tabindex:"-1"},u=s("a",{class:"header-anchor",href:"#如果确定结果只有一条-使用-limit-1","aria-label":'Permalink to "如果确定结果只有一条,使用 LIMIT 1 <Badge text="建议" />"'},"",-1),m=e("",3),v={id:"避免隐式类型转换",tabindex:"-1"},B=s("a",{class:"header-anchor",href:"#避免隐式类型转换","aria-label":'Permalink to "避免隐式类型转换 <Badge text="强制" type="danger" />"'},"",-1),T=e("",3),f={id:"列名带上前缀",tabindex:"-1"},N=s("a",{class:"header-anchor",href:"#列名带上前缀","aria-label":'Permalink to "列名带上前缀 <Badge text="建议" />"'},"",-1),I=e("",2),x={id:"非负数列添加unsigned无符号约束",tabindex:"-1"},S=s("a",{class:"header-anchor",href:"#非负数列添加unsigned无符号约束","aria-label":'Permalink to "非负数列添加UNSIGNED无符号约束 <Badge text="建议" />"'},"",-1),M=e("",2),L={id:"合理采用整数类型",tabindex:"-1"},R=s("a",{class:"header-anchor",href:"#合理采用整数类型","aria-label":'Permalink to "合理采用整数类型 <Badge text="建议" />"'},"",-1),P=e("",3),O={id:"布尔列采用bit类型",tabindex:"-1"},U=s("a",{class:"header-anchor",href:"#布尔列采用bit类型","aria-label":'Permalink to "布尔列采用bit类型 <Badge text="建议" />"'},"",-1),q=e("",3),V={id:"采用utf8mb4编码",tabindex:"-1"},Q=s("a",{class:"header-anchor",href:"#采用utf8mb4编码","aria-label":'Permalink to "采用utf8mb4编码 <Badge text="建议" />"'},"",-1),G=e("",1);function Y(l,H,w,$,K,W){const t=p("Badge"),d=c,r=p("ClientOnly");return k(),o("div",null,[s("h1",D,[i("个人 SQL 优化技巧 "),a(t,{text:"持续更新",type:"warning"}),i(),C]),a(r,null,{default:y(()=>{var n,h;return[(((n=l.$frontmatter)==null?void 0:n.aside)??!0)&&(((h=l.$frontmatter)==null?void 0:h.showArticleMetadata)??!0)?(k(),A(d,{key:0,article:l.$frontmatter},null,8,["article"])):_("",!0)]}),_:1}),E,s("h3",b,[i("如果确定结果只有一条,使用 LIMIT 1 "),a(t,{text:"建议"}),i(),u]),m,s("h3",v,[i("避免隐式类型转换 "),a(t,{text:"强制",type:"danger"}),i(),B]),T,s("h3",f,[i("列名带上前缀 "),a(t,{text:"建议"}),i(),N]),I,s("h3",x,[i("非负数列添加UNSIGNED无符号约束 "),a(t,{text:"建议"}),i(),S]),M,s("h3",L,[i("合理采用整数类型 "),a(t,{text:"建议"}),i(),R]),P,s("h3",O,[i("布尔列采用bit类型 "),a(t,{text:"建议"}),i(),U]),q,s("h3",V,[i("采用utf8mb4编码 "),a(t,{text:"建议"}),i(),Q]),G])}const Z=g(F,[["render",Y]]);export{X as __pageData,Z as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as d}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as t,o as n,c as g,k as h,a as e,I as l,w as A,R as C,b as c,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const L=JSON.parse('{"title":"个人常用 Stream 使用技巧","description":"","frontmatter":{"title":"个人常用 Stream 使用技巧","author":"查尔斯","date":"2019/12/29 15:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Java","Stream","Lambda"]},"headers":[],"relativePath":"categories/fragments/2019/12/29/个人常用Stream使用技巧.md","filePath":"categories/fragments/2019/12/29/个人常用Stream使用技巧.md","lastUpdated":1667545308000}'),D={name:"categories/fragments/2019/12/29/个人常用Stream使用技巧.md"},B={id:"个人常用-stream-使用技巧",tabindex:"-1"},m=h("a",{class:"header-anchor",href:"#个人常用-stream-使用技巧","aria-label":'Permalink to "个人常用 Stream 使用技巧 <Badge text="持续更新" type="warning" />"'},"",-1),F=C(`<h2 id="映射并以指定分隔符进行拼接" tabindex="-1">映射并以指定分隔符进行拼接 <a class="header-anchor" href="#映射并以指定分隔符进行拼接" aria-label="Permalink to "映射并以指定分隔符进行拼接""></a></h2><details class="details custom-block"><summary>需求:将角色中的角色名称取出来,并以“,”号分隔的形式将所有角色名称拼接成一个字符串。</summary><p>实现方案:通过 <code>map()</code> 可以只保留角色名称信息, 通过 <code>Collectors.joining()</code> 可以将角色名称以指定分隔符拼接起来。</p></details><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 1、准备一些实验数据, 代码不会像注释一样骗人, 所以就不单独对角色类中的字段解释了</span></span>
|
||||
import{_ as d}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as t,o as n,c as g,k as h,a as e,I as l,w as A,R as C,b as c,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const L=JSON.parse('{"title":"个人常用 Stream 使用技巧","description":"","frontmatter":{"title":"个人常用 Stream 使用技巧","author":"查尔斯","date":"2019/12/29 15:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Java","Stream","Lambda"]},"headers":[],"relativePath":"categories/fragments/2019/12/29/个人常用Stream使用技巧.md","filePath":"categories/fragments/2019/12/29/个人常用Stream使用技巧.md","lastUpdated":1667545308000}'),D={name:"categories/fragments/2019/12/29/个人常用Stream使用技巧.md"},B={id:"个人常用-stream-使用技巧",tabindex:"-1"},m=h("a",{class:"header-anchor",href:"#个人常用-stream-使用技巧","aria-label":'Permalink to "个人常用 Stream 使用技巧 <Badge text="持续更新" type="warning" />"'},"",-1),F=C(`<h2 id="映射并以指定分隔符进行拼接" tabindex="-1">映射并以指定分隔符进行拼接 <a class="header-anchor" href="#映射并以指定分隔符进行拼接" aria-label="Permalink to "映射并以指定分隔符进行拼接""></a></h2><details class="details custom-block"><summary>需求:将角色中的角色名称取出来,并以“,”号分隔的形式将所有角色名称拼接成一个字符串。</summary><p>实现方案:通过 <code>map()</code> 可以只保留角色名称信息, 通过 <code>Collectors.joining()</code> 可以将角色名称以指定分隔符拼接起来。</p></details><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 1、准备一些实验数据, 代码不会像注释一样骗人, 所以就不单独对角色类中的字段解释了</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">List</span><span style="--shiki-light:#24292E;--shiki-dark:#F69D50;"><</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">Role</span><span style="--shiki-light:#24292E;--shiki-dark:#F69D50;">> </span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">roleList</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> new</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> ArrayList<>(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">roleList.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">add</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;"> Role</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"超级管理员"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">));</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">roleList.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">add</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;"> Role</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"管理员"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">));</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as d}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as t,o as n,c as g,k as h,a as e,I as l,w as A,R as C,b as c,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const L=JSON.parse('{"title":"个人常用 Stream 使用技巧","description":"","frontmatter":{"title":"个人常用 Stream 使用技巧","author":"查尔斯","date":"2019/12/29 15:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Java","Stream","Lambda"]},"headers":[],"relativePath":"categories/fragments/2019/12/29/个人常用Stream使用技巧.md","filePath":"categories/fragments/2019/12/29/个人常用Stream使用技巧.md","lastUpdated":1667545308000}'),D={name:"categories/fragments/2019/12/29/个人常用Stream使用技巧.md"},B={id:"个人常用-stream-使用技巧",tabindex:"-1"},m=h("a",{class:"header-anchor",href:"#个人常用-stream-使用技巧","aria-label":'Permalink to "个人常用 Stream 使用技巧 <Badge text="持续更新" type="warning" />"'},"",-1),F=C("",3);function _(s,u,E,f,S,b){const k=t("Badge"),p=d,r=t("ClientOnly");return n(),g("div",null,[h("h1",B,[e("个人常用 Stream 使用技巧 "),l(k,{text:"持续更新",type:"warning"}),e(),m]),l(r,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),c(p,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),F])}const N=o(D,[["render",_]]);export{L as __pageData,N as default};
|
||||
import{_ as d}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as t,o as n,c as g,k as h,a as e,I as l,w as A,R as C,b as c,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const L=JSON.parse('{"title":"个人常用 Stream 使用技巧","description":"","frontmatter":{"title":"个人常用 Stream 使用技巧","author":"查尔斯","date":"2019/12/29 15:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Java","Stream","Lambda"]},"headers":[],"relativePath":"categories/fragments/2019/12/29/个人常用Stream使用技巧.md","filePath":"categories/fragments/2019/12/29/个人常用Stream使用技巧.md","lastUpdated":1667545308000}'),D={name:"categories/fragments/2019/12/29/个人常用Stream使用技巧.md"},B={id:"个人常用-stream-使用技巧",tabindex:"-1"},m=h("a",{class:"header-anchor",href:"#个人常用-stream-使用技巧","aria-label":'Permalink to "个人常用 Stream 使用技巧 <Badge text="持续更新" type="warning" />"'},"",-1),F=C("",3);function _(s,u,E,f,S,b){const k=t("Badge"),p=d,r=t("ClientOnly");return n(),g("div",null,[h("h1",B,[e("个人常用 Stream 使用技巧 "),l(k,{text:"持续更新",type:"warning"}),e(),m]),l(r,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),c(p,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),F])}const N=o(D,[["render",_]]);export{L as __pageData,N as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as d}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as g,D as n,o as l,c as A,k as t,a as h,I as k,w as D,R as y,b as c,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const M=JSON.parse('{"title":"个人常用 Hutool 工具类","description":"","frontmatter":{"title":"个人常用 Hutool 工具类","author":"查尔斯","date":"2019/12/30 19:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Java","Java工具类","Hutool"]},"headers":[],"relativePath":"categories/fragments/2019/12/30/个人常用Hutool工具类.md","filePath":"categories/fragments/2019/12/30/个人常用Hutool工具类.md","lastUpdated":1667545308000}'),o={name:"categories/fragments/2019/12/30/个人常用Hutool工具类.md"},F={id:"个人常用-hutool工-具类",tabindex:"-1"},B=t("a",{class:"header-anchor",href:"#个人常用-hutool工-具类","aria-label":'Permalink to "个人常用 Hutool工 具类 <Badge text="持续更新" type="warning" />"'},"",-1),u=y(`<p><strong>C:</strong> 技术圈常说一句:“你要会写轮子,也要会用轮子”。工作的时候,为了提升开发效率,节约开发时间,也常常提醒自己不要重复造 “轮子”。</p><p>每次开启一个新项目,除了搭建项目必备环境之外,必然要整理一下之前项目沉淀下来的工具类,然后 C V 大法。习惯了一些工具类后,新项目中用不了或是换一下总是感觉缺点什么,再加上每个人都有自己遇到或沉淀的工具类,项目中遇到工具类重复也是很常见的事儿。</p><p>话说回来,这些工具类就是开发中必不可少的一种 “轮子”。对于大多数同学,受限于技术,轮子可能勉强写的出来,但是写的是不是够好,够完善,这质量就没法保证了。</p><p>谁都是从一开始过来的,但好在有这么一些有志之士,将经年累月写过的轮子反复整理,反复打磨,推出了一个项目,它就是 Hutool。</p><p>接下来,笔者就带大家学习一些个人常用的 Hutool 工具类。</p><h2 id="判断相等" tabindex="-1">判断相等 <a class="header-anchor" href="#判断相等" aria-label="Permalink to "判断相等""></a></h2><h3 id="传统用法" tabindex="-1">传统用法 <a class="header-anchor" href="#传统用法" aria-label="Permalink to "传统用法""></a></h3><p>判断两个内容相等很常见了吧?</p><p>Java 7 的时候,官方还在 java.util 包下给提供了一个 Objects 工具类,源代码如下:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
import{_ as d}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as g,D as n,o as l,c as A,k as t,a as h,I as k,w as D,R as y,b as c,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const M=JSON.parse('{"title":"个人常用 Hutool 工具类","description":"","frontmatter":{"title":"个人常用 Hutool 工具类","author":"查尔斯","date":"2019/12/30 19:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Java","Java工具类","Hutool"]},"headers":[],"relativePath":"categories/fragments/2019/12/30/个人常用Hutool工具类.md","filePath":"categories/fragments/2019/12/30/个人常用Hutool工具类.md","lastUpdated":1667545308000}'),o={name:"categories/fragments/2019/12/30/个人常用Hutool工具类.md"},F={id:"个人常用-hutool工-具类",tabindex:"-1"},B=t("a",{class:"header-anchor",href:"#个人常用-hutool工-具类","aria-label":'Permalink to "个人常用 Hutool工 具类 <Badge text="持续更新" type="warning" />"'},"",-1),u=y(`<p><strong>C:</strong> 技术圈常说一句:“你要会写轮子,也要会用轮子”。工作的时候,为了提升开发效率,节约开发时间,也常常提醒自己不要重复造 “轮子”。</p><p>每次开启一个新项目,除了搭建项目必备环境之外,必然要整理一下之前项目沉淀下来的工具类,然后 C V 大法。习惯了一些工具类后,新项目中用不了或是换一下总是感觉缺点什么,再加上每个人都有自己遇到或沉淀的工具类,项目中遇到工具类重复也是很常见的事儿。</p><p>话说回来,这些工具类就是开发中必不可少的一种 “轮子”。对于大多数同学,受限于技术,轮子可能勉强写的出来,但是写的是不是够好,够完善,这质量就没法保证了。</p><p>谁都是从一开始过来的,但好在有这么一些有志之士,将经年累月写过的轮子反复整理,反复打磨,推出了一个项目,它就是 Hutool。</p><p>接下来,笔者就带大家学习一些个人常用的 Hutool 工具类。</p><h2 id="判断相等" tabindex="-1">判断相等 <a class="header-anchor" href="#判断相等" aria-label="Permalink to "判断相等""></a></h2><h3 id="传统用法" tabindex="-1">传统用法 <a class="header-anchor" href="#传统用法" aria-label="Permalink to "传统用法""></a></h3><p>判断两个内容相等很常见了吧?</p><p>Java 7 的时候,官方还在 java.util 包下给提供了一个 Objects 工具类,源代码如下:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * Returns {@code true} if the arguments are equal to each other</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * and {@code false} otherwise.</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * Consequently, if both arguments are {@code null}, {@code true}</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as d}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as g,D as n,o as l,c as A,k as t,a as h,I as k,w as D,R as y,b as c,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const M=JSON.parse('{"title":"个人常用 Hutool 工具类","description":"","frontmatter":{"title":"个人常用 Hutool 工具类","author":"查尔斯","date":"2019/12/30 19:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Java","Java工具类","Hutool"]},"headers":[],"relativePath":"categories/fragments/2019/12/30/个人常用Hutool工具类.md","filePath":"categories/fragments/2019/12/30/个人常用Hutool工具类.md","lastUpdated":1667545308000}'),o={name:"categories/fragments/2019/12/30/个人常用Hutool工具类.md"},F={id:"个人常用-hutool工-具类",tabindex:"-1"},B=t("a",{class:"header-anchor",href:"#个人常用-hutool工-具类","aria-label":'Permalink to "个人常用 Hutool工 具类 <Badge text="持续更新" type="warning" />"'},"",-1),u=y("",60);function E(s,m,b,v,j,q){const p=n("Badge"),e=d,r=n("ClientOnly");return l(),A("div",null,[t("h1",F,[h("个人常用 Hutool工 具类 "),k(p,{text:"持续更新",type:"warning"}),h(),B]),k(r,null,{default:D(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(l(),c(e,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),u])}const O=g(o,[["render",E]]);export{M as __pageData,O as default};
|
||||
import{_ as d}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as g,D as n,o as l,c as A,k as t,a as h,I as k,w as D,R as y,b as c,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const M=JSON.parse('{"title":"个人常用 Hutool 工具类","description":"","frontmatter":{"title":"个人常用 Hutool 工具类","author":"查尔斯","date":"2019/12/30 19:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Java","Java工具类","Hutool"]},"headers":[],"relativePath":"categories/fragments/2019/12/30/个人常用Hutool工具类.md","filePath":"categories/fragments/2019/12/30/个人常用Hutool工具类.md","lastUpdated":1667545308000}'),o={name:"categories/fragments/2019/12/30/个人常用Hutool工具类.md"},F={id:"个人常用-hutool工-具类",tabindex:"-1"},B=t("a",{class:"header-anchor",href:"#个人常用-hutool工-具类","aria-label":'Permalink to "个人常用 Hutool工 具类 <Badge text="持续更新" type="warning" />"'},"",-1),u=y("",60);function E(s,m,b,v,j,q){const p=n("Badge"),e=d,r=n("ClientOnly");return l(),A("div",null,[t("h1",F,[h("个人常用 Hutool工 具类 "),k(p,{text:"持续更新",type:"warning"}),h(),B]),k(r,null,{default:D(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(l(),c(e,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),u])}const O=g(o,[["render",E]]);export{M as __pageData,O as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as r}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as t,o as e,c,k as h,a as l,I as n,w as g,R as u,b as y,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const m="/assets/201912312031666.Y--7Iu1D.png",b="/assets/201912312031777.2j2lmfnd.png",C="/assets/201912312031888.QEBJqHwU.png",v="/assets/201912312031999.EQf4tV9O.png",D="/assets/201912312032666.eS3OHEyZ.png",f="/assets/201912312032777.mxlWgDCi.png",x="/assets/202209012051588.m0MxX_Or.png",R=JSON.parse('{"title":"个人常用 Linux 命令","description":"","frontmatter":{"title":"个人常用 Linux 命令","author":"查尔斯","date":"2019/12/31 21:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Linux"]},"headers":[],"relativePath":"categories/fragments/2019/12/31/个人常用Linux命令.md","filePath":"categories/fragments/2019/12/31/个人常用Linux命令.md","lastUpdated":1669526061000}'),A={name:"categories/fragments/2019/12/31/个人常用Linux命令.md"},P={id:"个人常用-linux-命令",tabindex:"-1"},q=h("a",{class:"header-anchor",href:"#个人常用-linux-命令","aria-label":'Permalink to "个人常用 Linux 命令 <Badge type="warning" text="持续更新" />"'},"",-1),_=u(`<h2 id="系统相关" tabindex="-1">系统相关 <a class="header-anchor" href="#系统相关" aria-label="Permalink to "系统相关""></a></h2><div class="tip custom-block"><p class="custom-block-title">已测试系统</p><p>CentOS 7.5、8.2</p></div><h3 id="查询系统详情" tabindex="-1">查询系统详情 <a class="header-anchor" href="#查询系统详情" aria-label="Permalink to "查询系统详情""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 详细输出所有信息,依次为内核名称,主机名,内核版本号,内核版本,硬件名,处理器类型,硬件平台类型,操作系统名称</span></span>
|
||||
import{_ as r}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as t,o as e,c,k as h,a as l,I as n,w as g,R as u,b as y,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const m="/assets/201912312031666.Y--7Iu1D.png",b="/assets/201912312031777.2j2lmfnd.png",C="/assets/201912312031888.QEBJqHwU.png",v="/assets/201912312031999.EQf4tV9O.png",D="/assets/201912312032666.eS3OHEyZ.png",f="/assets/201912312032777.mxlWgDCi.png",x="/assets/202209012051588.m0MxX_Or.png",R=JSON.parse('{"title":"个人常用 Linux 命令","description":"","frontmatter":{"title":"个人常用 Linux 命令","author":"查尔斯","date":"2019/12/31 21:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Linux"]},"headers":[],"relativePath":"categories/fragments/2019/12/31/个人常用Linux命令.md","filePath":"categories/fragments/2019/12/31/个人常用Linux命令.md","lastUpdated":1669526061000}'),A={name:"categories/fragments/2019/12/31/个人常用Linux命令.md"},P={id:"个人常用-linux-命令",tabindex:"-1"},q=h("a",{class:"header-anchor",href:"#个人常用-linux-命令","aria-label":'Permalink to "个人常用 Linux 命令 <Badge type="warning" text="持续更新" />"'},"",-1),_=u(`<h2 id="系统相关" tabindex="-1">系统相关 <a class="header-anchor" href="#系统相关" aria-label="Permalink to "系统相关""></a></h2><div class="tip custom-block"><p class="custom-block-title">已测试系统</p><p>CentOS 7.5、8.2</p></div><h3 id="查询系统详情" tabindex="-1">查询系统详情 <a class="header-anchor" href="#查询系统详情" aria-label="Permalink to "查询系统详情""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 详细输出所有信息,依次为内核名称,主机名,内核版本号,内核版本,硬件名,处理器类型,硬件平台类型,操作系统名称</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">uname</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -a</span></span></code></pre></div><p><img src="`+m+`" alt="201912312031666"></p><h3 id="查询系统发行版本" tabindex="-1">查询系统发行版本 <a class="header-anchor" href="#查询系统发行版本" aria-label="Permalink to "查询系统发行版本""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 只适合Redhat系的Linux</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">cat</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /etc/redhat-release</span></span></code></pre></div><p><img src="`+b+`" alt="201912312031777"></p><h3 id="查看cpu信息" tabindex="-1">查看CPU信息 <a class="header-anchor" href="#查看cpu信息" aria-label="Permalink to "查看CPU信息""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 逻辑CPU数量和CPU型号</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">cat</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /proc/cpuinfo</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> grep</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> cut</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -f2</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -d:</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> uniq</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -c</span></span></code></pre></div><p><img src="`+C+`" alt="201912312031888"></p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># CPU真实数量(有时候虽然逻辑CPU是8核,但可能是由两颗4核CPU构成的)</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as r}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as t,o as e,c,k as h,a as l,I as n,w as g,R as u,b as y,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const m="/assets/201912312031666.Y--7Iu1D.png",b="/assets/201912312031777.2j2lmfnd.png",C="/assets/201912312031888.QEBJqHwU.png",v="/assets/201912312031999.EQf4tV9O.png",D="/assets/201912312032666.eS3OHEyZ.png",f="/assets/201912312032777.mxlWgDCi.png",x="/assets/202209012051588.m0MxX_Or.png",R=JSON.parse('{"title":"个人常用 Linux 命令","description":"","frontmatter":{"title":"个人常用 Linux 命令","author":"查尔斯","date":"2019/12/31 21:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Linux"]},"headers":[],"relativePath":"categories/fragments/2019/12/31/个人常用Linux命令.md","filePath":"categories/fragments/2019/12/31/个人常用Linux命令.md","lastUpdated":1669526061000}'),A={name:"categories/fragments/2019/12/31/个人常用Linux命令.md"},P={id:"个人常用-linux-命令",tabindex:"-1"},q=h("a",{class:"header-anchor",href:"#个人常用-linux-命令","aria-label":'Permalink to "个人常用 Linux 命令 <Badge type="warning" text="持续更新" />"'},"",-1),_=u("",120);function B(s,S,E,T,U,w){const p=t("Badge"),d=r,k=t("ClientOnly");return e(),c("div",null,[h("h1",P,[l("个人常用 Linux 命令 "),n(p,{type:"warning",text:"持续更新"}),l(),q]),n(k,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(e(),y(d,{key:0,article:s.$frontmatter},null,8,["article"])):F("",!0)]}),_:1}),_])}const I=o(A,[["render",B]]);export{R as __pageData,I as default};
|
||||
import{_ as r}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as t,o as e,c,k as h,a as l,I as n,w as g,R as u,b as y,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const m="/assets/201912312031666.Y--7Iu1D.png",b="/assets/201912312031777.2j2lmfnd.png",C="/assets/201912312031888.QEBJqHwU.png",v="/assets/201912312031999.EQf4tV9O.png",D="/assets/201912312032666.eS3OHEyZ.png",f="/assets/201912312032777.mxlWgDCi.png",x="/assets/202209012051588.m0MxX_Or.png",R=JSON.parse('{"title":"个人常用 Linux 命令","description":"","frontmatter":{"title":"个人常用 Linux 命令","author":"查尔斯","date":"2019/12/31 21:00","isTop":true,"categories":["杂碎逆袭史"],"tags":["Linux"]},"headers":[],"relativePath":"categories/fragments/2019/12/31/个人常用Linux命令.md","filePath":"categories/fragments/2019/12/31/个人常用Linux命令.md","lastUpdated":1669526061000}'),A={name:"categories/fragments/2019/12/31/个人常用Linux命令.md"},P={id:"个人常用-linux-命令",tabindex:"-1"},q=h("a",{class:"header-anchor",href:"#个人常用-linux-命令","aria-label":'Permalink to "个人常用 Linux 命令 <Badge type="warning" text="持续更新" />"'},"",-1),_=u("",120);function B(s,S,E,T,U,w){const p=t("Badge"),d=r,k=t("ClientOnly");return e(),c("div",null,[h("h1",P,[l("个人常用 Linux 命令 "),n(p,{type:"warning",text:"持续更新"}),l(),q]),n(k,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(e(),y(d,{key:0,article:s.$frontmatter},null,8,["article"])):F("",!0)]}),_:1}),_])}const I=o(A,[["render",B]]);export{R as __pageData,I as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as t,D as e,o as n,c as d,I as r,w as g,k as l,a as D,R as A,b as y,e as c}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202103121800126.T1q4guIg.jpg",C="/assets/202103121800166.u-2Gtf0Z.webp",F="/assets/202103121800226.hjPZp3DJ.jpg",o="/assets/202103121800266.SZ-v1yOj.png",u="/assets/202103121800666.J2Iqslx8.png",j=JSON.parse('{"title":"精密计算工具类-BigDecimal","description":"","frontmatter":{"title":"精密计算工具类-BigDecimal","author":"查尔斯","date":"2021/03/12 18:07","categories":["杂碎逆袭史"],"tags":["Java","Java工具类"]},"headers":[],"relativePath":"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md","filePath":"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md","lastUpdated":1665668592000}'),m={name:"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md"},E=l("h1",{id:"精密计算工具类-bigdecimal",tabindex:"-1"},[D("精密计算工具类-BigDecimal "),l("a",{class:"header-anchor",href:"#精密计算工具类-bigdecimal","aria-label":'Permalink to "精密计算工具类-BigDecimal"'},"")],-1),b=A('<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 下方有两个 double 浮点数据在进行减法计算,你先猜测一下输出结果是多少?</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">16.27</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> -</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 3.12</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span></code></pre></div><p>当然了,可能有小部分同学会怀疑笔者在玩弄你们的智商,其实不是,笔者是在玩弄你们的感情。</p><p><img src="'+B+'" alt="202103121800126"></p><p>圆规正转,这结果究竟是多少?不是 <strong>13.15</strong> 吗?还真不是,结果是 <strong>13.149999999999999</strong> 。</p><p><img src="'+C+'" alt="202103121800166"></p><p><strong>你:</strong> 学了这么多年的数学,连两位的加减法都不行了吗?果然不是这块料儿。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>其实,你没算错,错的是计算机。16.27 和 3.12 这两个数字都是十进制,而我们都知道,计算机中是使用二进制来进行存储的,所以这意味着我们要使用 16.27 和 3.12 的时候,它会先做一次十进制到二进制的转换。由于计算机中存储浮点数时的特殊规则,部分浮点数会在这个过程中损失精度,结果自然就会出错了。而且它也不只是 Java 语言的专属问题,大多数语言都有这问题。[1]</p></div><p><img src="'+F+`" alt="202103121800226"></p><p>所以啊,一些需要精确计算的时候,你还敢用 double、float 类型吗?</p><p>不过也别着急,虽然不能用它们,但 Java 中也给你想好了招儿,Java 中提供了一个类型 BigDecimal ,可以帮助我们解决此类精确计算问题,一起来瞧瞧。</p><h2 id="简介" tabindex="-1">简介 <a class="header-anchor" href="#简介" aria-label="Permalink to "简介""></a></h2><div class="tip custom-block"><p class="custom-block-title">BigDecimal 简介</p><p>BigDecimal 是 Java 在 java.math 包中提供的一个计算类,是用来对超过 16 位有效位的数进行精确运算的。</p><p>在 《Effective Java》 一书中,就有提到 float 和 double 只能用来做科学计算或者是工程计算,在商业计算中要用 java.math.BigDecimal。[2]</p></div><h2 id="使用" tabindex="-1">使用 <a class="header-anchor" href="#使用" aria-label="Permalink to "使用""></a></h2><h3 id="构造方法" tabindex="-1">构造方法 <a class="header-anchor" href="#构造方法" aria-label="Permalink to "构造方法""></a></h3><p>BigDecimal 作为一个类,要先利用构造方法创建对象之后才能使用。</p><p>它的构造方法有很多,但是我们需要了解的只有两个。</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 利用 double 浮点数值作为构造参数</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as t,D as e,o as n,c as d,I as r,w as g,k as l,a as D,R as A,b as y,e as c}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202103121800126.T1q4guIg.jpg",C="/assets/202103121800166.u-2Gtf0Z.webp",F="/assets/202103121800226.hjPZp3DJ.jpg",o="/assets/202103121800266.SZ-v1yOj.png",u="/assets/202103121800666.J2Iqslx8.png",j=JSON.parse('{"title":"精密计算工具类-BigDecimal","description":"","frontmatter":{"title":"精密计算工具类-BigDecimal","author":"查尔斯","date":"2021/03/12 18:07","categories":["杂碎逆袭史"],"tags":["Java","Java工具类"]},"headers":[],"relativePath":"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md","filePath":"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md","lastUpdated":1665668592000}'),m={name:"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md"},E=l("h1",{id:"精密计算工具类-bigdecimal",tabindex:"-1"},[D("精密计算工具类-BigDecimal "),l("a",{class:"header-anchor",href:"#精密计算工具类-bigdecimal","aria-label":'Permalink to "精密计算工具类-BigDecimal"'},"")],-1),b=A('<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 下方有两个 double 浮点数据在进行减法计算,你先猜测一下输出结果是多少?</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">16.27</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> -</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 3.12</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span></code></pre></div><p>当然了,可能有小部分同学会怀疑笔者在玩弄你们的智商,其实不是,笔者是在玩弄你们的感情。</p><p><img src="'+B+'" alt="202103121800126"></p><p>圆规正转,这结果究竟是多少?不是 <strong>13.15</strong> 吗?还真不是,结果是 <strong>13.149999999999999</strong> 。</p><p><img src="'+C+'" alt="202103121800166"></p><p><strong>你:</strong> 学了这么多年的数学,连两位的加减法都不行了吗?果然不是这块料儿。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>其实,你没算错,错的是计算机。16.27 和 3.12 这两个数字都是十进制,而我们都知道,计算机中是使用二进制来进行存储的,所以这意味着我们要使用 16.27 和 3.12 的时候,它会先做一次十进制到二进制的转换。由于计算机中存储浮点数时的特殊规则,部分浮点数会在这个过程中损失精度,结果自然就会出错了。而且它也不只是 Java 语言的专属问题,大多数语言都有这问题。[1]</p></div><p><img src="'+F+`" alt="202103121800226"></p><p>所以啊,一些需要精确计算的时候,你还敢用 double、float 类型吗?</p><p>不过也别着急,虽然不能用它们,但 Java 中也给你想好了招儿,Java 中提供了一个类型 BigDecimal ,可以帮助我们解决此类精确计算问题,一起来瞧瞧。</p><h2 id="简介" tabindex="-1">简介 <a class="header-anchor" href="#简介" aria-label="Permalink to "简介""></a></h2><div class="tip custom-block"><p class="custom-block-title">BigDecimal 简介</p><p>BigDecimal 是 Java 在 java.math 包中提供的一个计算类,是用来对超过 16 位有效位的数进行精确运算的。</p><p>在 《Effective Java》 一书中,就有提到 float 和 double 只能用来做科学计算或者是工程计算,在商业计算中要用 java.math.BigDecimal。[2]</p></div><h2 id="使用" tabindex="-1">使用 <a class="header-anchor" href="#使用" aria-label="Permalink to "使用""></a></h2><h3 id="构造方法" tabindex="-1">构造方法 <a class="header-anchor" href="#构造方法" aria-label="Permalink to "构造方法""></a></h3><p>BigDecimal 作为一个类,要先利用构造方法创建对象之后才能使用。</p><p>它的构造方法有很多,但是我们需要了解的只有两个。</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 利用 double 浮点数值作为构造参数</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">BigDecimal</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">double</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> val)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> </span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 利用 字符串 作为构造参数[记得使用它]</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as t,D as e,o as n,c as d,I as r,w as g,k as l,a as D,R as A,b as y,e as c}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202103121800126.T1q4guIg.jpg",C="/assets/202103121800166.u-2Gtf0Z.webp",F="/assets/202103121800226.hjPZp3DJ.jpg",o="/assets/202103121800266.SZ-v1yOj.png",u="/assets/202103121800666.J2Iqslx8.png",j=JSON.parse('{"title":"精密计算工具类-BigDecimal","description":"","frontmatter":{"title":"精密计算工具类-BigDecimal","author":"查尔斯","date":"2021/03/12 18:07","categories":["杂碎逆袭史"],"tags":["Java","Java工具类"]},"headers":[],"relativePath":"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md","filePath":"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md","lastUpdated":1665668592000}'),m={name:"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md"},E=l("h1",{id:"精密计算工具类-bigdecimal",tabindex:"-1"},[D("精密计算工具类-BigDecimal "),l("a",{class:"header-anchor",href:"#精密计算工具类-bigdecimal","aria-label":'Permalink to "精密计算工具类-BigDecimal"'},"")],-1),b=A("",53);function v(s,_,q,f,N,w){const h=p,k=e("ClientOnly");return n(),d("div",null,[E,r(k,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(h,{key:0,article:s.$frontmatter},null,8,["article"])):c("",!0)]}),_:1}),b])}const P=t(m,[["render",v]]);export{j as __pageData,P as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as t,D as e,o as n,c as d,I as r,w as g,k as l,a as D,R as A,b as y,e as c}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202103121800126.T1q4guIg.jpg",C="/assets/202103121800166.u-2Gtf0Z.webp",F="/assets/202103121800226.hjPZp3DJ.jpg",o="/assets/202103121800266.SZ-v1yOj.png",u="/assets/202103121800666.J2Iqslx8.png",j=JSON.parse('{"title":"精密计算工具类-BigDecimal","description":"","frontmatter":{"title":"精密计算工具类-BigDecimal","author":"查尔斯","date":"2021/03/12 18:07","categories":["杂碎逆袭史"],"tags":["Java","Java工具类"]},"headers":[],"relativePath":"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md","filePath":"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md","lastUpdated":1665668592000}'),m={name:"categories/fragments/2021/03/12/精密计算工具类-BigDecimal.md"},E=l("h1",{id:"精密计算工具类-bigdecimal",tabindex:"-1"},[D("精密计算工具类-BigDecimal "),l("a",{class:"header-anchor",href:"#精密计算工具类-bigdecimal","aria-label":'Permalink to "精密计算工具类-BigDecimal"'},"")],-1),b=A("",53);function v(s,_,q,f,N,w){const h=p,k=e("ClientOnly");return n(),d("div",null,[E,r(k,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(h,{key:0,article:s.$frontmatter},null,8,["article"])):c("",!0)]}),_:1}),b])}const P=t(m,[["render",v]]);export{j as __pageData,P as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as t}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as r,I as d,w as g,k as l,a as A,R as c,b as y,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const o="/assets/202105291230868.9bhtcNU7.jpg",j=JSON.parse('{"title":"设计模式之单例模式","description":"","frontmatter":{"title":"设计模式之单例模式","author":"查尔斯","date":"2021/05/29 13:14","categories":["杂碎逆袭史"],"tags":["设计模式"]},"headers":[],"relativePath":"categories/fragments/2021/05/29/设计模式之单例模式.md","filePath":"categories/fragments/2021/05/29/设计模式之单例模式.md","lastUpdated":1662734844000}'),C={name:"categories/fragments/2021/05/29/设计模式之单例模式.md"},B=l("h1",{id:"设计模式之单例模式",tabindex:"-1"},[A("设计模式之单例模式 "),l("a",{class:"header-anchor",href:"#设计模式之单例模式","aria-label":'Permalink to "设计模式之单例模式"'},"")],-1),F=c('<p><strong>C:</strong> 在现代程序开发过程中,无论是新手还是老手,都要熟练掌握面向对象的编程思想及编程方式。</p><p>而在面向对象的编程方式中,我们作为程序的掌控者,在操作一些业务单元时,都要先创建好对应的对象,然后通过操作对象来实现业务处理。</p><p>正因如此,对象的创建自然是每个程序员都手到擒来的事情了。</p><p><img src="'+o+`" alt="202105291230868"></p><p>大多数情况下,我们创建对象都是采用如下方式实现的:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">类名 对象名 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> new</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 类名();</span></span></code></pre></div><p>这种方式是最基本的对象创建方式,每次执行 new 关键字,都会为该类产生一个新的对象。</p><p>但在一些特殊的场景下,对于一个特定的类,我们可能希望它在全局只产生一个对象,即每次我们获取它的对象时,获取到的永远都是同一个!</p><p>这个需求很常见,在众多设计模式中也恰好有一种可以满足我们这项需求的模式,它就是单例模式。</p><h2 id="简介" tabindex="-1">简介 <a class="header-anchor" href="#简介" aria-label="Permalink to "简介""></a></h2><p>单例模式(Singleton Pattern)是 Java 中最简单的设计模式之一。这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式。</p><p>这种模式涉及到一个单一的类,该类负责创建自己的对象,同时确保只有单个对象被创建。这个类提供了一种访问其唯一的对象的方式,可以直接访问,不需要实例化该类的对象。</p><p>作为创建型设计模式一员的单例模式,无论是在日常工作使用中,还是在基础面试过程中,亦或是面试一些框架原理时,都或多或少会提及它。</p><p>但是,大多数初级程序员对单例模式,仅仅是了解到两种实现方式,即懒汉式、饿汉式的程度,而实际上呢,在面对多线程的环境下,单例模式也诞生了很多性能又佳且线程安全的实现方式,本篇笔者就带你一起研究。</p><h2 id="饿汉式" tabindex="-1">饿汉式 <a class="header-anchor" href="#饿汉式" aria-label="Permalink to "饿汉式""></a></h2><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">public</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> Singleton</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
||||
import{_ as t}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as r,I as d,w as g,k as l,a as A,R as c,b as y,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const o="/assets/202105291230868.9bhtcNU7.jpg",j=JSON.parse('{"title":"设计模式之单例模式","description":"","frontmatter":{"title":"设计模式之单例模式","author":"查尔斯","date":"2021/05/29 13:14","categories":["杂碎逆袭史"],"tags":["设计模式"]},"headers":[],"relativePath":"categories/fragments/2021/05/29/设计模式之单例模式.md","filePath":"categories/fragments/2021/05/29/设计模式之单例模式.md","lastUpdated":1662734844000}'),C={name:"categories/fragments/2021/05/29/设计模式之单例模式.md"},B=l("h1",{id:"设计模式之单例模式",tabindex:"-1"},[A("设计模式之单例模式 "),l("a",{class:"header-anchor",href:"#设计模式之单例模式","aria-label":'Permalink to "设计模式之单例模式"'},"")],-1),F=c('<p><strong>C:</strong> 在现代程序开发过程中,无论是新手还是老手,都要熟练掌握面向对象的编程思想及编程方式。</p><p>而在面向对象的编程方式中,我们作为程序的掌控者,在操作一些业务单元时,都要先创建好对应的对象,然后通过操作对象来实现业务处理。</p><p>正因如此,对象的创建自然是每个程序员都手到擒来的事情了。</p><p><img src="'+o+`" alt="202105291230868"></p><p>大多数情况下,我们创建对象都是采用如下方式实现的:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">类名 对象名 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> new</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 类名();</span></span></code></pre></div><p>这种方式是最基本的对象创建方式,每次执行 new 关键字,都会为该类产生一个新的对象。</p><p>但在一些特殊的场景下,对于一个特定的类,我们可能希望它在全局只产生一个对象,即每次我们获取它的对象时,获取到的永远都是同一个!</p><p>这个需求很常见,在众多设计模式中也恰好有一种可以满足我们这项需求的模式,它就是单例模式。</p><h2 id="简介" tabindex="-1">简介 <a class="header-anchor" href="#简介" aria-label="Permalink to "简介""></a></h2><p>单例模式(Singleton Pattern)是 Java 中最简单的设计模式之一。这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式。</p><p>这种模式涉及到一个单一的类,该类负责创建自己的对象,同时确保只有单个对象被创建。这个类提供了一种访问其唯一的对象的方式,可以直接访问,不需要实例化该类的对象。</p><p>作为创建型设计模式一员的单例模式,无论是在日常工作使用中,还是在基础面试过程中,亦或是面试一些框架原理时,都或多或少会提及它。</p><p>但是,大多数初级程序员对单例模式,仅仅是了解到两种实现方式,即懒汉式、饿汉式的程度,而实际上呢,在面对多线程的环境下,单例模式也诞生了很多性能又佳且线程安全的实现方式,本篇笔者就带你一起研究。</p><h2 id="饿汉式" tabindex="-1">饿汉式 <a class="header-anchor" href="#饿汉式" aria-label="Permalink to "饿汉式""></a></h2><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">public</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> Singleton</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> /**</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * 私有化构造方法</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as t}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as r,I as d,w as g,k as l,a as A,R as c,b as y,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const o="/assets/202105291230868.9bhtcNU7.jpg",j=JSON.parse('{"title":"设计模式之单例模式","description":"","frontmatter":{"title":"设计模式之单例模式","author":"查尔斯","date":"2021/05/29 13:14","categories":["杂碎逆袭史"],"tags":["设计模式"]},"headers":[],"relativePath":"categories/fragments/2021/05/29/设计模式之单例模式.md","filePath":"categories/fragments/2021/05/29/设计模式之单例模式.md","lastUpdated":1662734844000}'),C={name:"categories/fragments/2021/05/29/设计模式之单例模式.md"},B=l("h1",{id:"设计模式之单例模式",tabindex:"-1"},[A("设计模式之单例模式 "),l("a",{class:"header-anchor",href:"#设计模式之单例模式","aria-label":'Permalink to "设计模式之单例模式"'},"")],-1),F=c("",75);function u(s,E,m,v,b,S){const p=t,h=e("ClientOnly");return n(),r("div",null,[B,d(h,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(p,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),F])}const q=k(C,[["render",u]]);export{j as __pageData,q as default};
|
||||
import{_ as t}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as r,I as d,w as g,k as l,a as A,R as c,b as y,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const o="/assets/202105291230868.9bhtcNU7.jpg",j=JSON.parse('{"title":"设计模式之单例模式","description":"","frontmatter":{"title":"设计模式之单例模式","author":"查尔斯","date":"2021/05/29 13:14","categories":["杂碎逆袭史"],"tags":["设计模式"]},"headers":[],"relativePath":"categories/fragments/2021/05/29/设计模式之单例模式.md","filePath":"categories/fragments/2021/05/29/设计模式之单例模式.md","lastUpdated":1662734844000}'),C={name:"categories/fragments/2021/05/29/设计模式之单例模式.md"},B=l("h1",{id:"设计模式之单例模式",tabindex:"-1"},[A("设计模式之单例模式 "),l("a",{class:"header-anchor",href:"#设计模式之单例模式","aria-label":'Permalink to "设计模式之单例模式"'},"")],-1),F=c("",75);function u(s,E,m,v,b,S){const p=t,h=e("ClientOnly");return n(),r("div",null,[B,d(h,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(p,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),F])}const q=k(C,[["render",u]]);export{j as __pageData,q as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as r}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as e,o as t,c,k as h,a as l,I as n,w as g,R as y,b as A,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"个人常用 SQL 函数","description":"","frontmatter":{"title":"个人常用 SQL 函数","author":"查尔斯","date":"2022/02/16 15:43","isTop":true,"categories":["杂碎逆袭史"],"tags":["SQL","SQL函数"]},"headers":[],"relativePath":"categories/fragments/2022/02/16/个人常用SQL函数.md","filePath":"categories/fragments/2022/02/16/个人常用SQL函数.md","lastUpdated":1668604952000}'),m={name:"categories/fragments/2022/02/16/个人常用SQL函数.md"},F={id:"个人常用-sql-函数",tabindex:"-1"},D=h("a",{class:"header-anchor",href:"#个人常用-sql-函数","aria-label":'Permalink to "个人常用 SQL 函数 <Badge text="持续更新" type="warning" />"'},"",-1),u=y(`<h2 id="时间函数" tabindex="-1">时间函数 <a class="header-anchor" href="#时间函数" aria-label="Permalink to "时间函数""></a></h2><h3 id="获取当前时间-mysql" tabindex="-1">获取当前时间(MySQL) <a class="header-anchor" href="#获取当前时间-mysql" aria-label="Permalink to "获取当前时间(MySQL)""></a></h3><div class="language-sql vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"># 输出格式为:yyyy</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">MM</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">dd HH:mm:ss</span></span>
|
||||
import{_ as r}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as e,o as t,c,k as h,a as l,I as n,w as g,R as y,b as A,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"个人常用 SQL 函数","description":"","frontmatter":{"title":"个人常用 SQL 函数","author":"查尔斯","date":"2022/02/16 15:43","isTop":true,"categories":["杂碎逆袭史"],"tags":["SQL","SQL函数"]},"headers":[],"relativePath":"categories/fragments/2022/02/16/个人常用SQL函数.md","filePath":"categories/fragments/2022/02/16/个人常用SQL函数.md","lastUpdated":1668604952000}'),m={name:"categories/fragments/2022/02/16/个人常用SQL函数.md"},F={id:"个人常用-sql-函数",tabindex:"-1"},D=h("a",{class:"header-anchor",href:"#个人常用-sql-函数","aria-label":'Permalink to "个人常用 SQL 函数 <Badge text="持续更新" type="warning" />"'},"",-1),u=y(`<h2 id="时间函数" tabindex="-1">时间函数 <a class="header-anchor" href="#时间函数" aria-label="Permalink to "时间函数""></a></h2><h3 id="获取当前时间-mysql" tabindex="-1">获取当前时间(MySQL) <a class="header-anchor" href="#获取当前时间-mysql" aria-label="Permalink to "获取当前时间(MySQL)""></a></h3><div class="language-sql vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"># 输出格式为:yyyy</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">MM</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">dd HH:mm:ss</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">NOW</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">();</span></span></code></pre></div><h3 id="获取当前时间秒-mysql" tabindex="-1">获取当前时间秒(MySQL) <a class="header-anchor" href="#获取当前时间秒-mysql" aria-label="Permalink to "获取当前时间秒(MySQL)""></a></h3><div class="language-sql vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"># 从 1970年1月1日 开始到现在的秒数</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">UNIX_TIMESTAMP();</span></span></code></pre></div><h3 id="计算两个时间之间的间隔-mysql" tabindex="-1">计算两个时间之间的间隔(MySQL) <a class="header-anchor" href="#计算两个时间之间的间隔-mysql" aria-label="Permalink to "计算两个时间之间的间隔(MySQL)""></a></h3><div class="language-sql vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"># unit 可选为FRAC_SECOND 毫秒、</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">SECOND</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 秒、</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">MINUTE</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 分钟、</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">HOUR</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 小时、</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">DAY</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 天、</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">WEEK</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 星期、</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">MONTH</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 月、</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">QUARTER</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 季度、</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">YEAR</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 年</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">TIMESTAMPDIFF(unit, datetime_expr1, datetime_expr2)</span></span></code></pre></div><h2 id="字符串函数" tabindex="-1">字符串函数 <a class="header-anchor" href="#字符串函数" aria-label="Permalink to "字符串函数""></a></h2><h3 id="拼接字符串-mysql" tabindex="-1">拼接字符串(MySQL) <a class="header-anchor" href="#拼接字符串-mysql" aria-label="Permalink to "拼接字符串(MySQL)""></a></h3><div class="language-sql vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"># 将多个字符串拼接在一起</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as r}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as e,o as t,c,k as h,a as l,I as n,w as g,R as y,b as A,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"个人常用 SQL 函数","description":"","frontmatter":{"title":"个人常用 SQL 函数","author":"查尔斯","date":"2022/02/16 15:43","isTop":true,"categories":["杂碎逆袭史"],"tags":["SQL","SQL函数"]},"headers":[],"relativePath":"categories/fragments/2022/02/16/个人常用SQL函数.md","filePath":"categories/fragments/2022/02/16/个人常用SQL函数.md","lastUpdated":1668604952000}'),m={name:"categories/fragments/2022/02/16/个人常用SQL函数.md"},F={id:"个人常用-sql-函数",tabindex:"-1"},D=h("a",{class:"header-anchor",href:"#个人常用-sql-函数","aria-label":'Permalink to "个人常用 SQL 函数 <Badge text="持续更新" type="warning" />"'},"",-1),u=y("",21);function E(s,_,b,v,B,T){const p=e("Badge"),k=r,d=e("ClientOnly");return t(),c("div",null,[h("h1",F,[l("个人常用 SQL 函数 "),n(p,{text:"持续更新",type:"warning"}),l(),D]),n(d,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),A(k,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),u])}const M=o(m,[["render",E]]);export{f as __pageData,M as default};
|
||||
import{_ as r}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as e,o as t,c,k as h,a as l,I as n,w as g,R as y,b as A,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"个人常用 SQL 函数","description":"","frontmatter":{"title":"个人常用 SQL 函数","author":"查尔斯","date":"2022/02/16 15:43","isTop":true,"categories":["杂碎逆袭史"],"tags":["SQL","SQL函数"]},"headers":[],"relativePath":"categories/fragments/2022/02/16/个人常用SQL函数.md","filePath":"categories/fragments/2022/02/16/个人常用SQL函数.md","lastUpdated":1668604952000}'),m={name:"categories/fragments/2022/02/16/个人常用SQL函数.md"},F={id:"个人常用-sql-函数",tabindex:"-1"},D=h("a",{class:"header-anchor",href:"#个人常用-sql-函数","aria-label":'Permalink to "个人常用 SQL 函数 <Badge text="持续更新" type="warning" />"'},"",-1),u=y("",21);function E(s,_,b,v,B,T){const p=e("Badge"),k=r,d=e("ClientOnly");return t(),c("div",null,[h("h1",F,[l("个人常用 SQL 函数 "),n(p,{text:"持续更新",type:"warning"}),l(),D]),n(d,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),A(k,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),u])}const M=o(m,[["render",E]]);export{f as __pageData,M as default};
|
@@ -1,3 +1,3 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as d,o as t,c as r,I as o,w as k,k as e,a as c,R as g,b as m,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202203252252923.ZcvBRYB4.png",C="/assets/202203252252926.0ffea8WI.png",y="/assets/202203252252929.0S8qxoCL.png",_="/assets/202203252252931._iNK4Vvz.png",V=JSON.parse('{"title":"合并两个Git仓库的历史提交记录","description":"","frontmatter":{"title":"合并两个Git仓库的历史提交记录","author":"查尔斯","date":"2022/03/25 21:30","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md","filePath":"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md","lastUpdated":1661780865000}'),b={name:"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md"},v=e("h1",{id:"合并两个git仓库的历史提交记录",tabindex:"-1"},[c("合并两个Git仓库的历史提交记录 "),e("a",{class:"header-anchor",href:"#合并两个git仓库的历史提交记录","aria-label":'Permalink to "合并两个Git仓库的历史提交记录"'},"")],-1),f=g(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 最近在下班的时间一直在维护一个基于 EL-Admin 这个开源后台管理系统的衍生开源项目。EL-Admin 这个项目是采用前后端分离架构开发的,所以在开源平台上是分为了两个项目库,一个前端的,一个后端的。</p><p>这本无可厚非,分成两个项目库,在开发时还是挺友好的,公司内部基本也是这个模式,但对于一个开源项目来说,分散为两个库还是有一些不利的方面。</p><ol><li>在管理 issue 上不太方便,项目作者要兼顾查看两个项目,而且有些小伙伴在提出 issue 时并不会管你这是前端库还是后端库,提就完事了。在这方面,EL-Admin 项目的作者应该也发现了这个问题,所以直接干脆的关闭了前端库的 issue 功能,集中在后端库一起管理。</li><li>在 star 方面会造成分流,前段时间看了看微博,在不知什么时候,竟然加入了一个明星超话,意外就看到置顶帖里标注了一点禁止创建其他小号超话,现在想想这不是一个意思吗?</li><li>...</li></ol><p>本来笔者最开始也是按原项目形式创建了两个 Git 仓库,但最近更换设备开发时单独要拉两次仓库,觉得很麻烦,思索了下突然意识到上述问题,干脆趁着这热乎劲儿,以后端仓库为主,把两个仓库合并一下。</p><h2 id="解决方案" tabindex="-1">解决方案 <a class="header-anchor" href="#解决方案" aria-label="Permalink to "解决方案""></a></h2><h3 id="将前端项目提交到后端库" tabindex="-1">将前端项目提交到后端库 <a class="header-anchor" href="#将前端项目提交到后端库" aria-label="Permalink to "将前端项目提交到后端库""></a></h3><p>这是笔者首先想到的方法,即将前端项目拉下来,然后将前端项目的源码放到后端库里,提交一下。很简单粗暴,但是这种方法会造成之前前端项目历史提交记录的丢失。</p><h3 id="不影响提交记录-合并仓库" tabindex="-1">不影响提交记录,合并仓库 <a class="header-anchor" href="#不影响提交记录-合并仓库" aria-label="Permalink to "不影响提交记录,合并仓库""></a></h3><p>笔者当然不希望将前端项目的历史提交记录丢失了,所以最终采用了下方的方案,完整步骤如下:</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>提示说明一下,后端仓库名叫:eladminx,前端仓库名叫:eladminx-web</p></div><ol><li><p>克隆后端项目仓库到本地(笔者没有在 git bash 中操作,而是在 cmd 中进行的)</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> clone</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> https://gitee.com/Charles7c/eladminx.git</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as d,o as t,c as r,I as o,w as k,k as e,a as c,R as g,b as m,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202203252252923.ZcvBRYB4.png",C="/assets/202203252252926.0ffea8WI.png",y="/assets/202203252252929.0S8qxoCL.png",_="/assets/202203252252931._iNK4Vvz.png",V=JSON.parse('{"title":"合并两个Git仓库的历史提交记录","description":"","frontmatter":{"title":"合并两个Git仓库的历史提交记录","author":"查尔斯","date":"2022/03/25 21:30","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md","filePath":"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md","lastUpdated":1661780865000}'),b={name:"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md"},v=e("h1",{id:"合并两个git仓库的历史提交记录",tabindex:"-1"},[c("合并两个Git仓库的历史提交记录 "),e("a",{class:"header-anchor",href:"#合并两个git仓库的历史提交记录","aria-label":'Permalink to "合并两个Git仓库的历史提交记录"'},"")],-1),f=g(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 最近在下班的时间一直在维护一个基于 EL-Admin 这个开源后台管理系统的衍生开源项目。EL-Admin 这个项目是采用前后端分离架构开发的,所以在开源平台上是分为了两个项目库,一个前端的,一个后端的。</p><p>这本无可厚非,分成两个项目库,在开发时还是挺友好的,公司内部基本也是这个模式,但对于一个开源项目来说,分散为两个库还是有一些不利的方面。</p><ol><li>在管理 issue 上不太方便,项目作者要兼顾查看两个项目,而且有些小伙伴在提出 issue 时并不会管你这是前端库还是后端库,提就完事了。在这方面,EL-Admin 项目的作者应该也发现了这个问题,所以直接干脆的关闭了前端库的 issue 功能,集中在后端库一起管理。</li><li>在 star 方面会造成分流,前段时间看了看微博,在不知什么时候,竟然加入了一个明星超话,意外就看到置顶帖里标注了一点禁止创建其他小号超话,现在想想这不是一个意思吗?</li><li>...</li></ol><p>本来笔者最开始也是按原项目形式创建了两个 Git 仓库,但最近更换设备开发时单独要拉两次仓库,觉得很麻烦,思索了下突然意识到上述问题,干脆趁着这热乎劲儿,以后端仓库为主,把两个仓库合并一下。</p><h2 id="解决方案" tabindex="-1">解决方案 <a class="header-anchor" href="#解决方案" aria-label="Permalink to "解决方案""></a></h2><h3 id="将前端项目提交到后端库" tabindex="-1">将前端项目提交到后端库 <a class="header-anchor" href="#将前端项目提交到后端库" aria-label="Permalink to "将前端项目提交到后端库""></a></h3><p>这是笔者首先想到的方法,即将前端项目拉下来,然后将前端项目的源码放到后端库里,提交一下。很简单粗暴,但是这种方法会造成之前前端项目历史提交记录的丢失。</p><h3 id="不影响提交记录-合并仓库" tabindex="-1">不影响提交记录,合并仓库 <a class="header-anchor" href="#不影响提交记录-合并仓库" aria-label="Permalink to "不影响提交记录,合并仓库""></a></h3><p>笔者当然不希望将前端项目的历史提交记录丢失了,所以最终采用了下方的方案,完整步骤如下:</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>提示说明一下,后端仓库名叫:eladminx,前端仓库名叫:eladminx-web</p></div><ol><li><p>克隆后端项目仓库到本地(笔者没有在 git bash 中操作,而是在 cmd 中进行的)</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> clone</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> https://gitee.com/Charles7c/eladminx.git</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> eladminx</span></span></code></pre></div><p><img src="`+u+'" alt="202203252252923"></p></li><li><p>将前端仓库作为后端仓库的远程仓库,起别名为 frontend(这个随便起)</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> remote</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> add</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -f</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> frontend</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> https://gitee.com/Charles7c/eladminx-web.git</span></span></code></pre></div><p><img src="'+C+'" alt="202203252252926"></p></li><li><p>将前端仓库的 master 分支(自己选择哪个分支)合并到后端仓库</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> merge</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --strategy</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> ours</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --no-commit</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> frontend/master</span></span></code></pre></div><p><img src="'+y+'" alt="202203252252929"></p><p>想法很美,但是报错了:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span>fatal: refusing to merge unrelated histories</span></span></code></pre></div><p>这是因为后端仓库的本地分支历史记录和前端仓库的历史记录不匹配,人家 Git 怀疑你是不是合并错了,但咱们知道就是要合并,写个声明 “表明出事儿与人家无关”就可以了。</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> merge</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --strategy</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> ours</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --allow-unrelated-histories</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --no-commit</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> frontend/master</span></span></code></pre></div><p><img src="'+_+`" alt="202203252252931"></p></li><li><p>将前端仓库的 master 分支内容放到在后端仓库内刚建好的 eladminx-web 文件夹中</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">mkdir</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> eladminx-web</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> read-tree</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --prefix=eladminx-web/</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -u</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> frontend/master</span></span></code></pre></div></li><li><p>提交刚才的修改(毕竟你刚才又合并又创建文件夹的,肯定要提交修改啊)</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> commit</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -m</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> "迁移前端项目仓库,与后端项目仓库合并"</span></span></code></pre></div></li><li><p>最后将本地的修改强制推送到远程仓库即可</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> push</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --force</span></span></code></pre></div></li></ol><p>到此为止,笔者这两个项目的 master 分支就合并完了,如果你想合并其他分支,例如:dev,那就首先把后端仓库的分支切换到 dev,然后将上述中的 master 这个分支名换为 dev 就可以了。</p><h2 id="后记" tabindex="-1">后记 <a class="header-anchor" href="#后记" aria-label="Permalink to "后记""></a></h2><p><strong>C:</strong> 关于这个合并,你以哪个仓库为主都可以。最后合并的提交记录是以历史提交时间进行降序排列的。</p>`,15);function D(s,x,B,q,G,P){const l=p,n=d("ClientOnly");return t(),r("div",null,[v,o(n,null,{default:k(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),m(l,{key:0,article:s.$frontmatter},null,8,["article"])):F("",!0)]}),_:1}),f])}const T=h(b,[["render",D]]);export{V as __pageData,T as default};
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as d,o as t,c as r,I as o,w as k,k as e,a as c,R as g,b as m,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202203252252923.ZcvBRYB4.png",C="/assets/202203252252926.0ffea8WI.png",y="/assets/202203252252929.0S8qxoCL.png",_="/assets/202203252252931._iNK4Vvz.png",V=JSON.parse('{"title":"合并两个Git仓库的历史提交记录","description":"","frontmatter":{"title":"合并两个Git仓库的历史提交记录","author":"查尔斯","date":"2022/03/25 21:30","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md","filePath":"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md","lastUpdated":1661780865000}'),b={name:"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md"},v=e("h1",{id:"合并两个git仓库的历史提交记录",tabindex:"-1"},[c("合并两个Git仓库的历史提交记录 "),e("a",{class:"header-anchor",href:"#合并两个git仓库的历史提交记录","aria-label":'Permalink to "合并两个Git仓库的历史提交记录"'},"")],-1),f=g("",15);function D(s,x,B,q,G,P){const l=p,n=d("ClientOnly");return t(),r("div",null,[v,o(n,null,{default:k(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),m(l,{key:0,article:s.$frontmatter},null,8,["article"])):F("",!0)]}),_:1}),f])}const T=h(b,[["render",D]]);export{V as __pageData,T as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as d,o as t,c as r,I as o,w as k,k as e,a as c,R as g,b as m,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202203252252923.ZcvBRYB4.png",C="/assets/202203252252926.0ffea8WI.png",y="/assets/202203252252929.0S8qxoCL.png",_="/assets/202203252252931._iNK4Vvz.png",V=JSON.parse('{"title":"合并两个Git仓库的历史提交记录","description":"","frontmatter":{"title":"合并两个Git仓库的历史提交记录","author":"查尔斯","date":"2022/03/25 21:30","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md","filePath":"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md","lastUpdated":1661780865000}'),b={name:"categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录.md"},v=e("h1",{id:"合并两个git仓库的历史提交记录",tabindex:"-1"},[c("合并两个Git仓库的历史提交记录 "),e("a",{class:"header-anchor",href:"#合并两个git仓库的历史提交记录","aria-label":'Permalink to "合并两个Git仓库的历史提交记录"'},"")],-1),f=g("",15);function D(s,x,B,q,G,P){const l=p,n=d("ClientOnly");return t(),r("div",null,[v,o(n,null,{default:k(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),m(l,{key:0,article:s.$frontmatter},null,8,["article"])):F("",!0)]}),_:1}),f])}const T=h(b,[["render",D]]);export{V as __pageData,T as default};
|
@@ -1 +1 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as h,o as e,c as p,I as d,w as c,k as i,a as k,R as g,b as m,e as _}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const N=JSON.parse('{"title":"修改Git最后一次提交记录的作者和邮箱","description":"","frontmatter":{"title":"修改Git最后一次提交记录的作者和邮箱","author":"查尔斯","date":"2022/03/26 10:30","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md","filePath":"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md"},C=i("h1",{id:"修改git最后一次提交记录的作者和邮箱",tabindex:"-1"},[k("修改Git最后一次提交记录的作者和邮箱 "),i("a",{class:"header-anchor",href:"#修改git最后一次提交记录的作者和邮箱","aria-label":'Permalink to "修改Git最后一次提交记录的作者和邮箱"'},"")],-1),F=g('<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 今天周末了,抽出了一点时间继续维护下之前提到过的衍生开源项目。修了一个 bug 后,提交了一下。但是突然想起来,今天开发用的是工作本,工作本中的 Git author、email 是配的真实姓名和公司邮箱,提交前忘了修改,现在已经推送到开源平台了,这肯定不行啊。</p><p>但是现在即使修改了本地的 Git author、email 配置,历史提交记录也改变不了啊。别着急,看看怎么解决的。</p><h2 id="问题解决" tabindex="-1">问题解决 <a class="header-anchor" href="#问题解决" aria-label="Permalink to "问题解决""></a></h2><p>如果你确定是和笔者一样的情况,即确保是要修改最后一次提交记录,无论有没有推送到远程仓库都没问题。解决方法就两步,是不是很简单?</p><ol><li><p>修改最后一次提交的作者和邮箱信息</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> commit</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --amend</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --author=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"Charles7c <charles7c@126.com>"</span></span></code></pre></div></li><li><p>最后将本地的修改强制推送到远程仓库即可(如果你没推送到远程仓库,这步就不需要执行了)</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> push</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --force</span></span></code></pre></div></li></ol><h2 id="后记" tabindex="-1">后记 <a class="header-anchor" href="#后记" aria-label="Permalink to "后记""></a></h2><p><strong>C:</strong> 另外说一下,如果你要修改最后一次提交记录的 commit message,执行下面的命令就可以了。</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> commit</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --amend</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -m</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> "要修改为的提交信息"</span></span></code></pre></div><p>上方修改作者和邮箱信息的命令,还可以继续加参数 <code>--date</code> 来修改提交时间,有需要的话去试试去吧。</p>',10);function b(a,y,f,v,D,G){const n=o,l=h("ClientOnly");return e(),p("div",null,[C,d(l,null,{default:c(()=>{var t,s;return[(((t=a.$frontmatter)==null?void 0:t.aside)??!0)&&(((s=a.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(e(),m(n,{key:0,article:a.$frontmatter},null,8,["article"])):_("",!0)]}),_:1}),F])}const T=r(u,[["render",b]]);export{N as __pageData,T as default};
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as h,o as e,c as p,I as d,w as c,k as i,a as k,R as g,b as m,e as _}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const N=JSON.parse('{"title":"修改Git最后一次提交记录的作者和邮箱","description":"","frontmatter":{"title":"修改Git最后一次提交记录的作者和邮箱","author":"查尔斯","date":"2022/03/26 10:30","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md","filePath":"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md"},C=i("h1",{id:"修改git最后一次提交记录的作者和邮箱",tabindex:"-1"},[k("修改Git最后一次提交记录的作者和邮箱 "),i("a",{class:"header-anchor",href:"#修改git最后一次提交记录的作者和邮箱","aria-label":'Permalink to "修改Git最后一次提交记录的作者和邮箱"'},"")],-1),F=g('<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 今天周末了,抽出了一点时间继续维护下之前提到过的衍生开源项目。修了一个 bug 后,提交了一下。但是突然想起来,今天开发用的是工作本,工作本中的 Git author、email 是配的真实姓名和公司邮箱,提交前忘了修改,现在已经推送到开源平台了,这肯定不行啊。</p><p>但是现在即使修改了本地的 Git author、email 配置,历史提交记录也改变不了啊。别着急,看看怎么解决的。</p><h2 id="问题解决" tabindex="-1">问题解决 <a class="header-anchor" href="#问题解决" aria-label="Permalink to "问题解决""></a></h2><p>如果你确定是和笔者一样的情况,即确保是要修改最后一次提交记录,无论有没有推送到远程仓库都没问题。解决方法就两步,是不是很简单?</p><ol><li><p>修改最后一次提交的作者和邮箱信息</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> commit</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --amend</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --author=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"Charles7c <charles7c@126.com>"</span></span></code></pre></div></li><li><p>最后将本地的修改强制推送到远程仓库即可(如果你没推送到远程仓库,这步就不需要执行了)</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> push</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --force</span></span></code></pre></div></li></ol><h2 id="后记" tabindex="-1">后记 <a class="header-anchor" href="#后记" aria-label="Permalink to "后记""></a></h2><p><strong>C:</strong> 另外说一下,如果你要修改最后一次提交记录的 commit message,执行下面的命令就可以了。</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> commit</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --amend</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -m</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> "要修改为的提交信息"</span></span></code></pre></div><p>上方修改作者和邮箱信息的命令,还可以继续加参数 <code>--date</code> 来修改提交时间,有需要的话去试试去吧。</p>',10);function b(a,y,f,v,D,G){const n=o,l=h("ClientOnly");return e(),p("div",null,[C,d(l,null,{default:c(()=>{var t,s;return[(((t=a.$frontmatter)==null?void 0:t.aside)??!0)&&(((s=a.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(e(),m(n,{key:0,article:a.$frontmatter},null,8,["article"])):_("",!0)]}),_:1}),F])}const T=r(u,[["render",b]]);export{N as __pageData,T as default};
|
@@ -1 +1 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as h,o as e,c as p,I as d,w as c,k as i,a as k,R as g,b as m,e as _}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const N=JSON.parse('{"title":"修改Git最后一次提交记录的作者和邮箱","description":"","frontmatter":{"title":"修改Git最后一次提交记录的作者和邮箱","author":"查尔斯","date":"2022/03/26 10:30","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md","filePath":"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md"},C=i("h1",{id:"修改git最后一次提交记录的作者和邮箱",tabindex:"-1"},[k("修改Git最后一次提交记录的作者和邮箱 "),i("a",{class:"header-anchor",href:"#修改git最后一次提交记录的作者和邮箱","aria-label":'Permalink to "修改Git最后一次提交记录的作者和邮箱"'},"")],-1),F=g("",10);function b(a,y,f,v,D,G){const n=o,l=h("ClientOnly");return e(),p("div",null,[C,d(l,null,{default:c(()=>{var t,s;return[(((t=a.$frontmatter)==null?void 0:t.aside)??!0)&&(((s=a.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(e(),m(n,{key:0,article:a.$frontmatter},null,8,["article"])):_("",!0)]}),_:1}),F])}const T=r(u,[["render",b]]);export{N as __pageData,T as default};
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as h,o as e,c as p,I as d,w as c,k as i,a as k,R as g,b as m,e as _}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const N=JSON.parse('{"title":"修改Git最后一次提交记录的作者和邮箱","description":"","frontmatter":{"title":"修改Git最后一次提交记录的作者和邮箱","author":"查尔斯","date":"2022/03/26 10:30","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md","filePath":"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱.md"},C=i("h1",{id:"修改git最后一次提交记录的作者和邮箱",tabindex:"-1"},[k("修改Git最后一次提交记录的作者和邮箱 "),i("a",{class:"header-anchor",href:"#修改git最后一次提交记录的作者和邮箱","aria-label":'Permalink to "修改Git最后一次提交记录的作者和邮箱"'},"")],-1),F=g("",10);function b(a,y,f,v,D,G){const n=o,l=h("ClientOnly");return e(),p("div",null,[C,d(l,null,{default:c(()=>{var t,s;return[(((t=a.$frontmatter)==null?void 0:t.aside)??!0)&&(((s=a.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(e(),m(n,{key:0,article:a.$frontmatter},null,8,["article"])):_("",!0)]}),_:1}),F])}const T=r(u,[["render",b]]);export{N as __pageData,T as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as r,o as t,c as o,I as k,w as c,k as n,a as _,R as d,b as F,e as g}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const G=JSON.parse('{"title":"修改Git所有提交记录中的作者和邮箱","description":"","frontmatter":{"title":"修改Git所有提交记录中的作者和邮箱","author":"查尔斯","date":"2022/03/27 13:00","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md","filePath":"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md"},m=n("h1",{id:"修改git所有提交记录中的作者和邮箱",tabindex:"-1"},[_("修改Git所有提交记录中的作者和邮箱 "),n("a",{class:"header-anchor",href:"#修改git所有提交记录中的作者和邮箱","aria-label":'Permalink to "修改Git所有提交记录中的作者和邮箱"'},"")],-1),y=d(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 上一篇,笔者介绍了怎么修改 Git 最后一次提交的作者和邮箱信息。那如果你是已经提交了很多次的记录,难道一个个的回退过去修改吗?显然不可能,所以本篇笔者带着大家认识一下如何批量修改 Git 提交记录中的作者和邮箱信息。</p><h2 id="问题解决" tabindex="-1">问题解决 <a class="header-anchor" href="#问题解决" aria-label="Permalink to "问题解决""></a></h2><p>解决方法其实就是编写一个脚本来进行批量替换。</p><ol><li><p>新建一个 sh / bat 格式的脚本文件(如果你是在 cmd 中执行,那就用 bat 格式,如果是在 git bash 中执行就用 sh)</p></li><li><p>复制下方脚本内容到脚本文件中,然后编辑替换好错误邮箱、正确作者和邮箱(如果是在 cmd 中执行,#!/bin/sh 就替换为 #!/bin/bat)</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">#!/bin/sh</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as r,o as t,c as o,I as k,w as c,k as n,a as _,R as d,b as F,e as g}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const G=JSON.parse('{"title":"修改Git所有提交记录中的作者和邮箱","description":"","frontmatter":{"title":"修改Git所有提交记录中的作者和邮箱","author":"查尔斯","date":"2022/03/27 13:00","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md","filePath":"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md"},m=n("h1",{id:"修改git所有提交记录中的作者和邮箱",tabindex:"-1"},[_("修改Git所有提交记录中的作者和邮箱 "),n("a",{class:"header-anchor",href:"#修改git所有提交记录中的作者和邮箱","aria-label":'Permalink to "修改Git所有提交记录中的作者和邮箱"'},"")],-1),y=d(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 上一篇,笔者介绍了怎么修改 Git 最后一次提交的作者和邮箱信息。那如果你是已经提交了很多次的记录,难道一个个的回退过去修改吗?显然不可能,所以本篇笔者带着大家认识一下如何批量修改 Git 提交记录中的作者和邮箱信息。</p><h2 id="问题解决" tabindex="-1">问题解决 <a class="header-anchor" href="#问题解决" aria-label="Permalink to "问题解决""></a></h2><p>解决方法其实就是编写一个脚本来进行批量替换。</p><ol><li><p>新建一个 sh / bat 格式的脚本文件(如果你是在 cmd 中执行,那就用 bat 格式,如果是在 git bash 中执行就用 sh)</p></li><li><p>复制下方脚本内容到脚本文件中,然后编辑替换好错误邮箱、正确作者和邮箱(如果是在 cmd 中执行,#!/bin/sh 就替换为 #!/bin/bat)</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">#!/bin/sh</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> filter-branch</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --env-filter</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> '</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">WRONG_EMAIL="错误的邮箱"</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as r,o as t,c as o,I as k,w as c,k as n,a as _,R as d,b as F,e as g}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const G=JSON.parse('{"title":"修改Git所有提交记录中的作者和邮箱","description":"","frontmatter":{"title":"修改Git所有提交记录中的作者和邮箱","author":"查尔斯","date":"2022/03/27 13:00","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md","filePath":"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md"},m=n("h1",{id:"修改git所有提交记录中的作者和邮箱",tabindex:"-1"},[_("修改Git所有提交记录中的作者和邮箱 "),n("a",{class:"header-anchor",href:"#修改git所有提交记录中的作者和邮箱","aria-label":'Permalink to "修改Git所有提交记录中的作者和邮箱"'},"")],-1),y=d("",6);function C(s,f,q,E,A,M){const e=p,l=r("ClientOnly");return t(),o("div",null,[m,k(l,null,{default:c(()=>{var a,i;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((i=s.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(t(),F(e,{key:0,article:s.$frontmatter},null,8,["article"])):g("",!0)]}),_:1}),y])}const N=h(u,[["render",C]]);export{G as __pageData,N as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as r,o as t,c as o,I as k,w as c,k as n,a as _,R as d,b as F,e as g}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const G=JSON.parse('{"title":"修改Git所有提交记录中的作者和邮箱","description":"","frontmatter":{"title":"修改Git所有提交记录中的作者和邮箱","author":"查尔斯","date":"2022/03/27 13:00","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md","filePath":"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱.md"},m=n("h1",{id:"修改git所有提交记录中的作者和邮箱",tabindex:"-1"},[_("修改Git所有提交记录中的作者和邮箱 "),n("a",{class:"header-anchor",href:"#修改git所有提交记录中的作者和邮箱","aria-label":'Permalink to "修改Git所有提交记录中的作者和邮箱"'},"")],-1),y=d("",6);function C(s,f,q,E,A,M){const e=p,l=r("ClientOnly");return t(),o("div",null,[m,k(l,null,{default:c(()=>{var a,i;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((i=s.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(t(),F(e,{key:0,article:s.$frontmatter},null,8,["article"])):g("",!0)]}),_:1}),y])}const N=h(u,[["render",C]]);export{G as __pageData,N as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as r,o as t,c as o,I as k,w as c,k as e,a as d,R as g,b as F,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B=JSON.parse('{"title":"为指定Git仓库单独配置用户名和邮箱","description":"","frontmatter":{"title":"为指定Git仓库单独配置用户名和邮箱","author":"查尔斯","date":"2022/03/28 21:29","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md","filePath":"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md"},_=e("h1",{id:"为指定git仓库单独配置用户名和邮箱",tabindex:"-1"},[d("为指定Git仓库单独配置用户名和邮箱 "),e("a",{class:"header-anchor",href:"#为指定git仓库单独配置用户名和邮箱","aria-label":'Permalink to "为指定Git仓库单独配置用户名和邮箱"'},"")],-1),y=g(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 在前几天里,笔者一直给大家分享关于如何在 Git 仓库中 “销赃匿迹”,究其原因是笔者最近业余时间用的是工作用笔记本来“干活”,工作用笔记本里的全局用户名和邮箱肯定是公司 GitLab 的信息了。</p><p>周末和工作日切换的时候,有时候兴致上来,没有及时修改全局用户名等信息,就直接 commit ,push 了,等到发现时那肯定就要用前几天的几个法子来挽救一下了。</p><p>可能会有同学问,你怎么不为指定仓库做一下局部用户名配置呢?是的,没错,有全局配置就会有局部配置,但笔者之所以还会出这种问题,主要有两点:</p><ol><li>clone 了不知道多少个仓库,不是只在操作一个仓库的时候,每个都要配置,很是麻烦,直接一个全局配置搞定,多么简单</li><li>兴致上来,有一两个仓库就忘了配置</li></ol><p>当然,如果后面笔者长期用工作用笔记本在业余时间“干活”的话,也完全可以将工作 Git 仓库们进行局部配置,毕竟相较来讲,工作仓库是稳定的。</p><p>闲话少说,下面贴一下为指定 Git 仓库做局部用户名和邮箱配置的方法。</p><h2 id="全局配置用户名和邮箱" tabindex="-1">全局配置用户名和邮箱 <a class="header-anchor" href="#全局配置用户名和邮箱" aria-label="Permalink to "全局配置用户名和邮箱""></a></h2><p>我们先一起回忆下全局配置用户名和邮箱的方法,在任意 Git 仓库里进行如下配置即可:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 全局配置用户名</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as r,o as t,c as o,I as k,w as c,k as e,a as d,R as g,b as F,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B=JSON.parse('{"title":"为指定Git仓库单独配置用户名和邮箱","description":"","frontmatter":{"title":"为指定Git仓库单独配置用户名和邮箱","author":"查尔斯","date":"2022/03/28 21:29","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md","filePath":"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md"},_=e("h1",{id:"为指定git仓库单独配置用户名和邮箱",tabindex:"-1"},[d("为指定Git仓库单独配置用户名和邮箱 "),e("a",{class:"header-anchor",href:"#为指定git仓库单独配置用户名和邮箱","aria-label":'Permalink to "为指定Git仓库单独配置用户名和邮箱"'},"")],-1),y=g(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 在前几天里,笔者一直给大家分享关于如何在 Git 仓库中 “销赃匿迹”,究其原因是笔者最近业余时间用的是工作用笔记本来“干活”,工作用笔记本里的全局用户名和邮箱肯定是公司 GitLab 的信息了。</p><p>周末和工作日切换的时候,有时候兴致上来,没有及时修改全局用户名等信息,就直接 commit ,push 了,等到发现时那肯定就要用前几天的几个法子来挽救一下了。</p><p>可能会有同学问,你怎么不为指定仓库做一下局部用户名配置呢?是的,没错,有全局配置就会有局部配置,但笔者之所以还会出这种问题,主要有两点:</p><ol><li>clone 了不知道多少个仓库,不是只在操作一个仓库的时候,每个都要配置,很是麻烦,直接一个全局配置搞定,多么简单</li><li>兴致上来,有一两个仓库就忘了配置</li></ol><p>当然,如果后面笔者长期用工作用笔记本在业余时间“干活”的话,也完全可以将工作 Git 仓库们进行局部配置,毕竟相较来讲,工作仓库是稳定的。</p><p>闲话少说,下面贴一下为指定 Git 仓库做局部用户名和邮箱配置的方法。</p><h2 id="全局配置用户名和邮箱" tabindex="-1">全局配置用户名和邮箱 <a class="header-anchor" href="#全局配置用户名和邮箱" aria-label="Permalink to "全局配置用户名和邮箱""></a></h2><p>我们先一起回忆下全局配置用户名和邮箱的方法,在任意 Git 仓库里进行如下配置即可:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 全局配置用户名</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> config</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --global</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> user.name</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> "Charles7c"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 全局配置邮箱</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> config</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --global</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> user.email</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> "charles7c@126.com"</span></span></code></pre></div><h2 id="局部配置用户名和邮箱" tabindex="-1">局部配置用户名和邮箱 <a class="header-anchor" href="#局部配置用户名和邮箱" aria-label="Permalink to "局部配置用户名和邮箱""></a></h2><p>局部配置的方法也是非常简单,首先进入指定的 Git 仓库,然后进行如下配置即可:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 进入指定 Git 仓库</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as r,o as t,c as o,I as k,w as c,k as e,a as d,R as g,b as F,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B=JSON.parse('{"title":"为指定Git仓库单独配置用户名和邮箱","description":"","frontmatter":{"title":"为指定Git仓库单独配置用户名和邮箱","author":"查尔斯","date":"2022/03/28 21:29","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md","filePath":"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md"},_=e("h1",{id:"为指定git仓库单独配置用户名和邮箱",tabindex:"-1"},[d("为指定Git仓库单独配置用户名和邮箱 "),e("a",{class:"header-anchor",href:"#为指定git仓库单独配置用户名和邮箱","aria-label":'Permalink to "为指定Git仓库单独配置用户名和邮箱"'},"")],-1),y=g("",16);function D(s,C,b,f,v,G){const n=p,l=r("ClientOnly");return t(),o("div",null,[_,k(l,null,{default:c(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),F(n,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),y])}const N=h(u,[["render",D]]);export{B as __pageData,N as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as r,o as t,c as o,I as k,w as c,k as e,a as d,R as g,b as F,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B=JSON.parse('{"title":"为指定Git仓库单独配置用户名和邮箱","description":"","frontmatter":{"title":"为指定Git仓库单独配置用户名和邮箱","author":"查尔斯","date":"2022/03/28 21:29","categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md","filePath":"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md","lastUpdated":1661780865000}'),u={name:"categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱.md"},_=e("h1",{id:"为指定git仓库单独配置用户名和邮箱",tabindex:"-1"},[d("为指定Git仓库单独配置用户名和邮箱 "),e("a",{class:"header-anchor",href:"#为指定git仓库单独配置用户名和邮箱","aria-label":'Permalink to "为指定Git仓库单独配置用户名和邮箱"'},"")],-1),y=g("",16);function D(s,C,b,f,v,G){const n=p,l=r("ClientOnly");return t(),o("div",null,[_,k(l,null,{default:c(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),F(n,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),y])}const N=h(u,[["render",D]]);export{B as __pageData,N as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as n}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as h,c as d,I as r,w as g,k as t,a as F,R as y,b as C,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const q=JSON.parse('{"title":"内网CentOS服务器设置网络代理","description":"","frontmatter":{"title":"内网CentOS服务器设置网络代理","author":"查尔斯","date":"2022/08/29 20:53","categories":["杂碎逆袭史"],"tags":["Linux","CentOS","网络代理"]},"headers":[],"relativePath":"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md","filePath":"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md","lastUpdated":1665146648000}'),A={name:"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md"},B=t("h1",{id:"内网centos服务器设置网络代理",tabindex:"-1"},[F("内网CentOS服务器设置网络代理 "),t("a",{class:"header-anchor",href:"#内网centos服务器设置网络代理","aria-label":'Permalink to "内网CentOS服务器设置网络代理"'},"")],-1),o=y(`<p><strong>C:</strong> 今天在网管那新申请了一台服务器,打算用来做测试环境。但是内网服务器没有网络,所以需要设置一下网络代理才能满足上网要求。</p><h2 id="设置http-https代理" tabindex="-1">设置http/https代理 <a class="header-anchor" href="#设置http-https代理" aria-label="Permalink to "设置http/https代理""></a></h2><ol><li><p>修改 profile 文件</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">vi</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /etc/profile</span></span></code></pre></div></li><li><p>在 profile 文件末尾,追加下方配置内容</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 注意:这台机器必须能够访问配置的代理服务器</span></span>
|
||||
import{_ as n}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as h,c as d,I as r,w as g,k as t,a as F,R as y,b as C,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const q=JSON.parse('{"title":"内网CentOS服务器设置网络代理","description":"","frontmatter":{"title":"内网CentOS服务器设置网络代理","author":"查尔斯","date":"2022/08/29 20:53","categories":["杂碎逆袭史"],"tags":["Linux","CentOS","网络代理"]},"headers":[],"relativePath":"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md","filePath":"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md","lastUpdated":1665146648000}'),A={name:"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md"},B=t("h1",{id:"内网centos服务器设置网络代理",tabindex:"-1"},[F("内网CentOS服务器设置网络代理 "),t("a",{class:"header-anchor",href:"#内网centos服务器设置网络代理","aria-label":'Permalink to "内网CentOS服务器设置网络代理"'},"")],-1),o=y(`<p><strong>C:</strong> 今天在网管那新申请了一台服务器,打算用来做测试环境。但是内网服务器没有网络,所以需要设置一下网络代理才能满足上网要求。</p><h2 id="设置http-https代理" tabindex="-1">设置http/https代理 <a class="header-anchor" href="#设置http-https代理" aria-label="Permalink to "设置http/https代理""></a></h2><ol><li><p>修改 profile 文件</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">vi</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /etc/profile</span></span></code></pre></div></li><li><p>在 profile 文件末尾,追加下方配置内容</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 注意:这台机器必须能够访问配置的代理服务器</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> http_proxy</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">http://你的代理服务器地址:你的代理服务器端口号</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> https_proxy</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">http://你的代理服务器地址:你的代理服务器端口号</span></span></code></pre></div><p>如果你的代理服务器需要登录,那么只需要如下写法即可:</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 注意:这台机器必须能够访问配置的代理服务器</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> http_proxy</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">http://用户名:密码@你的代理服务器地址:你的代理服务器端口号</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as n}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as h,c as d,I as r,w as g,k as t,a as F,R as y,b as C,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const q=JSON.parse('{"title":"内网CentOS服务器设置网络代理","description":"","frontmatter":{"title":"内网CentOS服务器设置网络代理","author":"查尔斯","date":"2022/08/29 20:53","categories":["杂碎逆袭史"],"tags":["Linux","CentOS","网络代理"]},"headers":[],"relativePath":"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md","filePath":"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md","lastUpdated":1665146648000}'),A={name:"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md"},B=t("h1",{id:"内网centos服务器设置网络代理",tabindex:"-1"},[F("内网CentOS服务器设置网络代理 "),t("a",{class:"header-anchor",href:"#内网centos服务器设置网络代理","aria-label":'Permalink to "内网CentOS服务器设置网络代理"'},"")],-1),o=y("",12);function c(i,E,m,u,b,v){const k=n,l=e("ClientOnly");return h(),d("div",null,[B,r(l,null,{default:g(()=>{var s,a;return[(((s=i.$frontmatter)==null?void 0:s.aside)??!0)&&(((a=i.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(h(),C(k,{key:0,article:i.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),o])}const x=p(A,[["render",c]]);export{q as __pageData,x as default};
|
||||
import{_ as n}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as h,c as d,I as r,w as g,k as t,a as F,R as y,b as C,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const q=JSON.parse('{"title":"内网CentOS服务器设置网络代理","description":"","frontmatter":{"title":"内网CentOS服务器设置网络代理","author":"查尔斯","date":"2022/08/29 20:53","categories":["杂碎逆袭史"],"tags":["Linux","CentOS","网络代理"]},"headers":[],"relativePath":"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md","filePath":"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md","lastUpdated":1665146648000}'),A={name:"categories/fragments/2022/08/29/内网CentOS服务器设置网络代理.md"},B=t("h1",{id:"内网centos服务器设置网络代理",tabindex:"-1"},[F("内网CentOS服务器设置网络代理 "),t("a",{class:"header-anchor",href:"#内网centos服务器设置网络代理","aria-label":'Permalink to "内网CentOS服务器设置网络代理"'},"")],-1),o=y("",12);function c(i,E,m,u,b,v){const k=n,l=e("ClientOnly");return h(),d("div",null,[B,r(l,null,{default:g(()=>{var s,a;return[(((s=i.$frontmatter)==null?void 0:s.aside)??!0)&&(((a=i.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(h(),C(k,{key:0,article:i.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),o])}const x=p(A,[["render",c]]);export{q as __pageData,x as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as r}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as e,o as l,c,k as n,a as t,I as h,w as g,R as F,b as y,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const w=JSON.parse('{"title":"个人常用 Docker 命令","description":"","frontmatter":{"title":"个人常用 Docker 命令","author":"查尔斯","date":"2022/10/01 22:33","isTop":true,"categories":["杂碎逆袭史"],"tags":["Docker"]},"headers":[],"relativePath":"categories/fragments/2022/10/01/个人常用Docker命令.md","filePath":"categories/fragments/2022/10/01/个人常用Docker命令.md","lastUpdated":1667738288000}'),m={name:"categories/fragments/2022/10/01/个人常用Docker命令.md"},D={id:"个人常用-docker-命令",tabindex:"-1"},b=n("a",{class:"header-anchor",href:"#个人常用-docker-命令","aria-label":'Permalink to "个人常用 Docker 命令 <Badge text="持续更新" type="warning" />"'},"",-1),C=F(`<h2 id="镜像相关" tabindex="-1">镜像相关 <a class="header-anchor" href="#镜像相关" aria-label="Permalink to "镜像相关""></a></h2><h3 id="查看本地镜像列表" tabindex="-1">查看本地镜像列表 <a class="header-anchor" href="#查看本地镜像列表" aria-label="Permalink to "查看本地镜像列表""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> images</span></span></code></pre></div><h3 id="从记录中心查询镜像" tabindex="-1">从记录中心查询镜像 <a class="header-anchor" href="#从记录中心查询镜像" aria-label="Permalink to "从记录中心查询镜像""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> search</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> 镜像关键词</span></span></code></pre></div><h3 id="从记录中心拉取镜像到本地" tabindex="-1">从记录中心拉取镜像到本地 <a class="header-anchor" href="#从记录中心拉取镜像到本地" aria-label="Permalink to "从记录中心拉取镜像到本地""></a></h3><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>如果镜像名称后不指定 <strong>标签/版本</strong> ,则会默认使用最新版本(latest)。</p><p>例如:docker pull tomcat:8.5.0 拉取的就是 8.5.0 版本的 tomcat 镜像,而 docker pull tomcat -> 拉取的实际是 docker pull tomcat:latest,这个 latest 是跟随记录中心中的最新版本变化的,无法确定当前拉取的是哪一个版本。</p></div><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> pull</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> 镜像名称[:标签/版本]</span></span></code></pre></div><h3 id="删除本地镜像" tabindex="-1">删除本地镜像 <a class="header-anchor" href="#删除本地镜像" aria-label="Permalink to "删除本地镜像""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 删除指定镜像</span></span>
|
||||
import{_ as r}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as e,o as l,c,k as n,a as t,I as h,w as g,R as F,b as y,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const w=JSON.parse('{"title":"个人常用 Docker 命令","description":"","frontmatter":{"title":"个人常用 Docker 命令","author":"查尔斯","date":"2022/10/01 22:33","isTop":true,"categories":["杂碎逆袭史"],"tags":["Docker"]},"headers":[],"relativePath":"categories/fragments/2022/10/01/个人常用Docker命令.md","filePath":"categories/fragments/2022/10/01/个人常用Docker命令.md","lastUpdated":1667738288000}'),m={name:"categories/fragments/2022/10/01/个人常用Docker命令.md"},D={id:"个人常用-docker-命令",tabindex:"-1"},b=n("a",{class:"header-anchor",href:"#个人常用-docker-命令","aria-label":'Permalink to "个人常用 Docker 命令 <Badge text="持续更新" type="warning" />"'},"",-1),C=F(`<h2 id="镜像相关" tabindex="-1">镜像相关 <a class="header-anchor" href="#镜像相关" aria-label="Permalink to "镜像相关""></a></h2><h3 id="查看本地镜像列表" tabindex="-1">查看本地镜像列表 <a class="header-anchor" href="#查看本地镜像列表" aria-label="Permalink to "查看本地镜像列表""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> images</span></span></code></pre></div><h3 id="从记录中心查询镜像" tabindex="-1">从记录中心查询镜像 <a class="header-anchor" href="#从记录中心查询镜像" aria-label="Permalink to "从记录中心查询镜像""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> search</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> 镜像关键词</span></span></code></pre></div><h3 id="从记录中心拉取镜像到本地" tabindex="-1">从记录中心拉取镜像到本地 <a class="header-anchor" href="#从记录中心拉取镜像到本地" aria-label="Permalink to "从记录中心拉取镜像到本地""></a></h3><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>如果镜像名称后不指定 <strong>标签/版本</strong> ,则会默认使用最新版本(latest)。</p><p>例如:docker pull tomcat:8.5.0 拉取的就是 8.5.0 版本的 tomcat 镜像,而 docker pull tomcat -> 拉取的实际是 docker pull tomcat:latest,这个 latest 是跟随记录中心中的最新版本变化的,无法确定当前拉取的是哪一个版本。</p></div><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> pull</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> 镜像名称[:标签/版本]</span></span></code></pre></div><h3 id="删除本地镜像" tabindex="-1">删除本地镜像 <a class="header-anchor" href="#删除本地镜像" aria-label="Permalink to "删除本地镜像""></a></h3><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 删除指定镜像</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> rmi</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> 镜像ID/镜像名称</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> [镜像ID/镜像名称...]</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 删除所有镜像</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as r}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as e,o as l,c,k as n,a as t,I as h,w as g,R as F,b as y,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const w=JSON.parse('{"title":"个人常用 Docker 命令","description":"","frontmatter":{"title":"个人常用 Docker 命令","author":"查尔斯","date":"2022/10/01 22:33","isTop":true,"categories":["杂碎逆袭史"],"tags":["Docker"]},"headers":[],"relativePath":"categories/fragments/2022/10/01/个人常用Docker命令.md","filePath":"categories/fragments/2022/10/01/个人常用Docker命令.md","lastUpdated":1667738288000}'),m={name:"categories/fragments/2022/10/01/个人常用Docker命令.md"},D={id:"个人常用-docker-命令",tabindex:"-1"},b=n("a",{class:"header-anchor",href:"#个人常用-docker-命令","aria-label":'Permalink to "个人常用 Docker 命令 <Badge text="持续更新" type="warning" />"'},"",-1),C=F("",76);function v(s,q,f,A,x,_){const p=e("Badge"),k=r,d=e("ClientOnly");return l(),c("div",null,[n("h1",D,[t("个人常用 Docker 命令 "),h(p,{text:"持续更新",type:"warning"}),t(),b]),h(d,null,{default:g(()=>{var a,i;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((i=s.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(l(),y(k,{key:0,article:s.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),C])}const E=o(m,[["render",v]]);export{w as __pageData,E as default};
|
||||
import{_ as r}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as e,o as l,c,k as n,a as t,I as h,w as g,R as F,b as y,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const w=JSON.parse('{"title":"个人常用 Docker 命令","description":"","frontmatter":{"title":"个人常用 Docker 命令","author":"查尔斯","date":"2022/10/01 22:33","isTop":true,"categories":["杂碎逆袭史"],"tags":["Docker"]},"headers":[],"relativePath":"categories/fragments/2022/10/01/个人常用Docker命令.md","filePath":"categories/fragments/2022/10/01/个人常用Docker命令.md","lastUpdated":1667738288000}'),m={name:"categories/fragments/2022/10/01/个人常用Docker命令.md"},D={id:"个人常用-docker-命令",tabindex:"-1"},b=n("a",{class:"header-anchor",href:"#个人常用-docker-命令","aria-label":'Permalink to "个人常用 Docker 命令 <Badge text="持续更新" type="warning" />"'},"",-1),C=F("",76);function v(s,q,f,A,x,_){const p=e("Badge"),k=r,d=e("ClientOnly");return l(),c("div",null,[n("h1",D,[t("个人常用 Docker 命令 "),h(p,{text:"持续更新",type:"warning"}),t(),b]),h(d,null,{default:g(()=>{var a,i;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((i=s.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(l(),y(k,{key:0,article:s.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),C])}const E=o(m,[["render",v]]);export{w as __pageData,E as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as e,o as t,c,k as n,a as l,I as h,w as g,R as F,b as u,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const G=JSON.parse('{"title":"个人常用 Git 命令","description":"","frontmatter":{"title":"个人常用 Git 命令","author":"查尔斯","date":"2022/10/05 21:30","isTop":true,"categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/10/05/个人常用Git命令.md","filePath":"categories/fragments/2022/10/05/个人常用Git命令.md","lastUpdated":1702555195000}'),m={name:"categories/fragments/2022/10/05/个人常用Git命令.md"},b={id:"个人常用-git-命令",tabindex:"-1"},C=n("a",{class:"header-anchor",href:"#个人常用-git-命令","aria-label":'Permalink to "个人常用 Git 命令 <Badge text="持续更新" type="warning" />"'},"",-1),v=F(`<h2 id="初始配置" tabindex="-1">初始配置 <a class="header-anchor" href="#初始配置" aria-label="Permalink to "初始配置""></a></h2><h3 id="全局配置" tabindex="-1">全局配置 <a class="header-anchor" href="#全局配置" aria-label="Permalink to "全局配置""></a></h3><p>在进行版本管理之前,首先需要对 Git 进行用户配置。</p><p>全局配置指的是当前终端上的所有仓库使用该配置,可以在任何位置设置。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 全局配置用户名</span></span>
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as e,o as t,c,k as n,a as l,I as h,w as g,R as F,b as u,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const G=JSON.parse('{"title":"个人常用 Git 命令","description":"","frontmatter":{"title":"个人常用 Git 命令","author":"查尔斯","date":"2022/10/05 21:30","isTop":true,"categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/10/05/个人常用Git命令.md","filePath":"categories/fragments/2022/10/05/个人常用Git命令.md","lastUpdated":1702555195000}'),m={name:"categories/fragments/2022/10/05/个人常用Git命令.md"},b={id:"个人常用-git-命令",tabindex:"-1"},C=n("a",{class:"header-anchor",href:"#个人常用-git-命令","aria-label":'Permalink to "个人常用 Git 命令 <Badge text="持续更新" type="warning" />"'},"",-1),v=F(`<h2 id="初始配置" tabindex="-1">初始配置 <a class="header-anchor" href="#初始配置" aria-label="Permalink to "初始配置""></a></h2><h3 id="全局配置" tabindex="-1">全局配置 <a class="header-anchor" href="#全局配置" aria-label="Permalink to "全局配置""></a></h3><p>在进行版本管理之前,首先需要对 Git 进行用户配置。</p><p>全局配置指的是当前终端上的所有仓库使用该配置,可以在任何位置设置。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 全局配置用户名</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> config</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --global</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> user.name</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> "用户名"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 全局配置用户邮箱</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> config</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --global</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> user.email</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> "用户邮箱"</span></span></code></pre></div><h3 id="局部配置" tabindex="-1">局部配置 <a class="header-anchor" href="#局部配置" aria-label="Permalink to "局部配置""></a></h3><p>局部配置指的是当前终端上的指定仓库使用该配置,需要在指定仓库内进行设置。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 局部配置用户名</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as e,o as t,c,k as n,a as l,I as h,w as g,R as F,b as u,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const G=JSON.parse('{"title":"个人常用 Git 命令","description":"","frontmatter":{"title":"个人常用 Git 命令","author":"查尔斯","date":"2022/10/05 21:30","isTop":true,"categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/10/05/个人常用Git命令.md","filePath":"categories/fragments/2022/10/05/个人常用Git命令.md","lastUpdated":1702555195000}'),m={name:"categories/fragments/2022/10/05/个人常用Git命令.md"},b={id:"个人常用-git-命令",tabindex:"-1"},C=n("a",{class:"header-anchor",href:"#个人常用-git-命令","aria-label":'Permalink to "个人常用 Git 命令 <Badge text="持续更新" type="warning" />"'},"",-1),v=F("",79);function D(s,q,A,f,_,x){const p=e("Badge"),d=o,k=e("ClientOnly");return t(),c("div",null,[n("h1",b,[l("个人常用 Git 命令 "),h(p,{text:"持续更新",type:"warning"}),l(),C]),h(k,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),u(d,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),v])}const H=r(m,[["render",D]]);export{G as __pageData,H as default};
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as e,o as t,c,k as n,a as l,I as h,w as g,R as F,b as u,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const G=JSON.parse('{"title":"个人常用 Git 命令","description":"","frontmatter":{"title":"个人常用 Git 命令","author":"查尔斯","date":"2022/10/05 21:30","isTop":true,"categories":["杂碎逆袭史"],"tags":["Git"]},"headers":[],"relativePath":"categories/fragments/2022/10/05/个人常用Git命令.md","filePath":"categories/fragments/2022/10/05/个人常用Git命令.md","lastUpdated":1702555195000}'),m={name:"categories/fragments/2022/10/05/个人常用Git命令.md"},b={id:"个人常用-git-命令",tabindex:"-1"},C=n("a",{class:"header-anchor",href:"#个人常用-git-命令","aria-label":'Permalink to "个人常用 Git 命令 <Badge text="持续更新" type="warning" />"'},"",-1),v=F("",79);function D(s,q,A,f,_,x){const p=e("Badge"),d=o,k=e("ClientOnly");return t(),c("div",null,[n("h1",b,[l("个人常用 Git 命令 "),h(p,{text:"持续更新",type:"warning"}),l(),C]),h(k,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),u(d,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),v])}const H=r(m,[["render",D]]);export{G as __pageData,H as default};
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as u,D as e,o as a,c as h,k as n,a as r,I as o,w as C,R as m,b as _,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const V=JSON.parse('{"title":"个人常用快捷键","description":"","frontmatter":{"title":"个人常用快捷键","author":"查尔斯","date":"2022/10/06 12:42","isTop":true,"categories":["杂碎逆袭史"],"tags":["快捷键","Windows","IntelliJ IDEA"]},"headers":[],"relativePath":"categories/fragments/2022/10/06/个人常用快捷键.md","filePath":"categories/fragments/2022/10/06/个人常用快捷键.md","lastUpdated":1702555195000}'),S={name:"categories/fragments/2022/10/06/个人常用快捷键.md"},b={id:"个人常用快捷键",tabindex:"-1"},A=n("a",{class:"header-anchor",href:"#个人常用快捷键","aria-label":'Permalink to "个人常用快捷键 <Badge text="持续更新" type="warning" />"'},"",-1),w=m("",12);function g(l,T,F,k,x,W){const s=e("Badge"),c=p,d=e("ClientOnly");return a(),h("div",null,[n("h1",b,[r("个人常用快捷键 "),o(s,{text:"持续更新",type:"warning"}),r(),A]),o(d,null,{default:C(()=>{var i,t;return[(((i=l.$frontmatter)==null?void 0:i.aside)??!0)&&(((t=l.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(a(),_(c,{key:0,article:l.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),w])}const v=u(S,[["render",g]]);export{V as __pageData,v as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as u,D as e,o as a,c as h,k as n,a as r,I as o,w as C,R as m,b as _,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const V=JSON.parse('{"title":"个人常用快捷键","description":"","frontmatter":{"title":"个人常用快捷键","author":"查尔斯","date":"2022/10/06 12:42","isTop":true,"categories":["杂碎逆袭史"],"tags":["快捷键","Windows","IntelliJ IDEA"]},"headers":[],"relativePath":"categories/fragments/2022/10/06/个人常用快捷键.md","filePath":"categories/fragments/2022/10/06/个人常用快捷键.md","lastUpdated":1702555195000}'),S={name:"categories/fragments/2022/10/06/个人常用快捷键.md"},b={id:"个人常用快捷键",tabindex:"-1"},A=n("a",{class:"header-anchor",href:"#个人常用快捷键","aria-label":'Permalink to "个人常用快捷键 <Badge text="持续更新" type="warning" />"'},"",-1),w=m("",12);function g(l,T,F,k,x,W){const s=e("Badge"),c=p,d=e("ClientOnly");return a(),h("div",null,[n("h1",b,[r("个人常用快捷键 "),o(s,{text:"持续更新",type:"warning"}),r(),A]),o(d,null,{default:C(()=>{var i,t;return[(((i=l.$frontmatter)==null?void 0:i.aside)??!0)&&(((t=l.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(a(),_(c,{key:0,article:l.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),w])}const v=u(S,[["render",g]]);export{V as __pageData,v as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as t}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as l,a as c,R as g,b as D,e as A}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202210262026166.7NMI1PbT.png",F="/assets/202210262026266.QaUul6zt.png",C="/assets/202210262026566.0Ep_K354.png",O=JSON.parse('{"title":"Docker 安装 OpenLDAP 详细步骤","description":"","frontmatter":{"title":"Docker 安装 OpenLDAP 详细步骤","author":"查尔斯","date":"2022/10/26 20:28","categories":["杂碎逆袭史"],"tags":["LDAP","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/26/Docker安装OpenLDAP.md","filePath":"categories/fragments/2022/10/26/Docker安装OpenLDAP.md","lastUpdated":1668325225000}'),m={name:"categories/fragments/2022/10/26/Docker安装OpenLDAP.md"},u=l("h1",{id:"docker-安装-openldap-详细步骤",tabindex:"-1"},[c("Docker 安装 OpenLDAP 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-openldap-详细步骤","aria-label":'Permalink to "Docker 安装 OpenLDAP 详细步骤"'},"")],-1),_=g(`<div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>笔者下面的步骤及配置是基于指定版本的实践,大多数程序大多数情况下在相差不大的版本时可以直接参考。(当然了,即使是非 Docker 方式安装程序也是一样道理)</p></div><h2 id="拉取镜像" tabindex="-1">拉取镜像 <a class="header-anchor" href="#拉取镜像" aria-label="Permalink to "拉取镜像""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>拉取镜像时需要明确镜像版本(Tag)。</p></div><p>不指定版本(Tag)就拉取镜像,那拉取下来的镜像版本(Tag)默认是 <code>latest</code>(最新的)。<code>latest</code> 会跟随 Docker Registry 中的记录变化,现在拉取下来的 <code>latest</code> 是 x1 版本,但隔了一段时间后你在其他机器上再拉取 <code>latest</code> 可能就是 x2 版本了。</p><p>变化的版本,不利于生产环境部署的稳定。无论是后续在其他环境部署还是扩容集群等场景均要求根据架构要求指定好版本。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> pull</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> osixia/openldap:1.5.0</span></span></code></pre></div><h2 id="运行容器" tabindex="-1">运行容器 <a class="header-anchor" href="#运行容器" aria-label="Permalink to "运行容器""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p><strong>下方的配置,切记要根据个人实际情况来修改。</strong></p></div><ul><li>容器的名称</li><li>镜像名称:版本</li><li>是否设置自启动?</li><li>是否端口映射?</li><li>环境变量配置</li><li>映射的话映射到宿主机哪个端口?</li><li>是否挂载卷?</li><li>挂载的话要挂载宿主机哪个目录?</li><li>......</li><li>等自定义配置</li></ul><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># LDAP_ORGANISATION 组织名称,默认为 Example Inc</span></span>
|
||||
import{_ as t}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as l,a as c,R as g,b as D,e as A}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202210262026166.7NMI1PbT.png",F="/assets/202210262026266.QaUul6zt.png",C="/assets/202210262026566.0Ep_K354.png",O=JSON.parse('{"title":"Docker 安装 OpenLDAP 详细步骤","description":"","frontmatter":{"title":"Docker 安装 OpenLDAP 详细步骤","author":"查尔斯","date":"2022/10/26 20:28","categories":["杂碎逆袭史"],"tags":["LDAP","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/26/Docker安装OpenLDAP.md","filePath":"categories/fragments/2022/10/26/Docker安装OpenLDAP.md","lastUpdated":1668325225000}'),m={name:"categories/fragments/2022/10/26/Docker安装OpenLDAP.md"},u=l("h1",{id:"docker-安装-openldap-详细步骤",tabindex:"-1"},[c("Docker 安装 OpenLDAP 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-openldap-详细步骤","aria-label":'Permalink to "Docker 安装 OpenLDAP 详细步骤"'},"")],-1),_=g(`<div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>笔者下面的步骤及配置是基于指定版本的实践,大多数程序大多数情况下在相差不大的版本时可以直接参考。(当然了,即使是非 Docker 方式安装程序也是一样道理)</p></div><h2 id="拉取镜像" tabindex="-1">拉取镜像 <a class="header-anchor" href="#拉取镜像" aria-label="Permalink to "拉取镜像""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>拉取镜像时需要明确镜像版本(Tag)。</p></div><p>不指定版本(Tag)就拉取镜像,那拉取下来的镜像版本(Tag)默认是 <code>latest</code>(最新的)。<code>latest</code> 会跟随 Docker Registry 中的记录变化,现在拉取下来的 <code>latest</code> 是 x1 版本,但隔了一段时间后你在其他机器上再拉取 <code>latest</code> 可能就是 x2 版本了。</p><p>变化的版本,不利于生产环境部署的稳定。无论是后续在其他环境部署还是扩容集群等场景均要求根据架构要求指定好版本。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> pull</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> osixia/openldap:1.5.0</span></span></code></pre></div><h2 id="运行容器" tabindex="-1">运行容器 <a class="header-anchor" href="#运行容器" aria-label="Permalink to "运行容器""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p><strong>下方的配置,切记要根据个人实际情况来修改。</strong></p></div><ul><li>容器的名称</li><li>镜像名称:版本</li><li>是否设置自启动?</li><li>是否端口映射?</li><li>环境变量配置</li><li>映射的话映射到宿主机哪个端口?</li><li>是否挂载卷?</li><li>挂载的话要挂载宿主机哪个目录?</li><li>......</li><li>等自定义配置</li></ul><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># LDAP_ORGANISATION 组织名称,默认为 Example Inc</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># LDAP_DOMAIN 域,默认为 example.org</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># LDAP_ADMIN_PASSWORD 管理员密码,默认为 admin</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># LDAP_TLS_VERIFY_CLIENT TLS验证客户端</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as t}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as l,a as c,R as g,b as D,e as A}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202210262026166.7NMI1PbT.png",F="/assets/202210262026266.QaUul6zt.png",C="/assets/202210262026566.0Ep_K354.png",O=JSON.parse('{"title":"Docker 安装 OpenLDAP 详细步骤","description":"","frontmatter":{"title":"Docker 安装 OpenLDAP 详细步骤","author":"查尔斯","date":"2022/10/26 20:28","categories":["杂碎逆袭史"],"tags":["LDAP","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/26/Docker安装OpenLDAP.md","filePath":"categories/fragments/2022/10/26/Docker安装OpenLDAP.md","lastUpdated":1668325225000}'),m={name:"categories/fragments/2022/10/26/Docker安装OpenLDAP.md"},u=l("h1",{id:"docker-安装-openldap-详细步骤",tabindex:"-1"},[c("Docker 安装 OpenLDAP 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-openldap-详细步骤","aria-label":'Permalink to "Docker 安装 OpenLDAP 详细步骤"'},"")],-1),_=g("",20);function B(s,v,b,E,P,L){const e=t,p=k("ClientOnly");return n(),r("div",null,[u,d(p,null,{default:o(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),D(e,{key:0,article:s.$frontmatter},null,8,["article"])):A("",!0)]}),_:1}),_])}const T=h(m,[["render",B]]);export{O as __pageData,T as default};
|
||||
import{_ as t}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as l,a as c,R as g,b as D,e as A}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202210262026166.7NMI1PbT.png",F="/assets/202210262026266.QaUul6zt.png",C="/assets/202210262026566.0Ep_K354.png",O=JSON.parse('{"title":"Docker 安装 OpenLDAP 详细步骤","description":"","frontmatter":{"title":"Docker 安装 OpenLDAP 详细步骤","author":"查尔斯","date":"2022/10/26 20:28","categories":["杂碎逆袭史"],"tags":["LDAP","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/26/Docker安装OpenLDAP.md","filePath":"categories/fragments/2022/10/26/Docker安装OpenLDAP.md","lastUpdated":1668325225000}'),m={name:"categories/fragments/2022/10/26/Docker安装OpenLDAP.md"},u=l("h1",{id:"docker-安装-openldap-详细步骤",tabindex:"-1"},[c("Docker 安装 OpenLDAP 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-openldap-详细步骤","aria-label":'Permalink to "Docker 安装 OpenLDAP 详细步骤"'},"")],-1),_=g("",20);function B(s,v,b,E,P,L){const e=t,p=k("ClientOnly");return n(),r("div",null,[u,d(p,null,{default:o(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),D(e,{key:0,article:s.$frontmatter},null,8,["article"])):A("",!0)]}),_:1}),_])}const T=h(m,[["render",B]]);export{O as __pageData,T as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as o,I as r,w as c,k as l,a as d,R as g,b as C,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const T=JSON.parse('{"title":"Docker 安装 Consul 详细步骤","description":"","frontmatter":{"title":"Docker 安装 Consul 详细步骤","author":"查尔斯","date":"2022/10/27 22:00","categories":["杂碎逆袭史"],"tags":["Consul","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/27/Docker安装Consul.md","filePath":"categories/fragments/2022/10/27/Docker安装Consul.md","lastUpdated":1668325225000}'),y={name:"categories/fragments/2022/10/27/Docker安装Consul.md"},D=l("h1",{id:"docker-安装-consul-详细步骤",tabindex:"-1"},[d("Docker 安装 Consul 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-consul-详细步骤","aria-label":'Permalink to "Docker 安装 Consul 详细步骤"'},"")],-1),m=g(`<div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>笔者下面的步骤及配置是基于指定版本的实践,大多数程序大多数情况下在相差不大的版本时可以直接参考。(当然了,即使是非 Docker 方式安装程序也是一样道理)</p></div><h2 id="拉取镜像" tabindex="-1">拉取镜像 <a class="header-anchor" href="#拉取镜像" aria-label="Permalink to "拉取镜像""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>拉取镜像时需要明确镜像版本(Tag)。</p></div><p>不指定版本(Tag)就拉取镜像,那拉取下来的镜像版本(Tag)默认是 <code>latest</code>(最新的)。<code>latest</code> 会跟随 Docker Registry 中的记录变化,现在拉取下来的 <code>latest</code> 是 x1 版本,但隔了一段时间后你在其他机器上再拉取 <code>latest</code> 可能就是 x2 版本了。</p><p>变化的版本,不利于生产环境部署的稳定。无论是后续在其他环境部署还是扩容集群等场景均要求根据架构要求指定好版本。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> pull</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> consul:1.13.3</span></span></code></pre></div><h2 id="运行容器" tabindex="-1">运行容器 <a class="header-anchor" href="#运行容器" aria-label="Permalink to "运行容器""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p><strong>下方的配置,切记要根据个人实际情况来修改。</strong></p></div><ul><li>容器的名称</li><li>镜像名称:版本</li><li>是否设置自启动?</li><li>是否端口映射?</li><li>映射的话映射到宿主机哪个端口?</li><li>是否挂载卷?</li><li>挂载的话要挂载宿主机哪个目录?</li><li>......</li><li>等自定义配置</li></ul><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -d</span><span style="--shiki-light:#005CC5;--shiki-dark:#F47067;"> \\</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as o,I as r,w as c,k as l,a as d,R as g,b as C,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const T=JSON.parse('{"title":"Docker 安装 Consul 详细步骤","description":"","frontmatter":{"title":"Docker 安装 Consul 详细步骤","author":"查尔斯","date":"2022/10/27 22:00","categories":["杂碎逆袭史"],"tags":["Consul","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/27/Docker安装Consul.md","filePath":"categories/fragments/2022/10/27/Docker安装Consul.md","lastUpdated":1668325225000}'),y={name:"categories/fragments/2022/10/27/Docker安装Consul.md"},D=l("h1",{id:"docker-安装-consul-详细步骤",tabindex:"-1"},[d("Docker 安装 Consul 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-consul-详细步骤","aria-label":'Permalink to "Docker 安装 Consul 详细步骤"'},"")],-1),m=g(`<div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>笔者下面的步骤及配置是基于指定版本的实践,大多数程序大多数情况下在相差不大的版本时可以直接参考。(当然了,即使是非 Docker 方式安装程序也是一样道理)</p></div><h2 id="拉取镜像" tabindex="-1">拉取镜像 <a class="header-anchor" href="#拉取镜像" aria-label="Permalink to "拉取镜像""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>拉取镜像时需要明确镜像版本(Tag)。</p></div><p>不指定版本(Tag)就拉取镜像,那拉取下来的镜像版本(Tag)默认是 <code>latest</code>(最新的)。<code>latest</code> 会跟随 Docker Registry 中的记录变化,现在拉取下来的 <code>latest</code> 是 x1 版本,但隔了一段时间后你在其他机器上再拉取 <code>latest</code> 可能就是 x2 版本了。</p><p>变化的版本,不利于生产环境部署的稳定。无论是后续在其他环境部署还是扩容集群等场景均要求根据架构要求指定好版本。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> pull</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> consul:1.13.3</span></span></code></pre></div><h2 id="运行容器" tabindex="-1">运行容器 <a class="header-anchor" href="#运行容器" aria-label="Permalink to "运行容器""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p><strong>下方的配置,切记要根据个人实际情况来修改。</strong></p></div><ul><li>容器的名称</li><li>镜像名称:版本</li><li>是否设置自启动?</li><li>是否端口映射?</li><li>映射的话映射到宿主机哪个端口?</li><li>是否挂载卷?</li><li>挂载的话要挂载宿主机哪个目录?</li><li>......</li><li>等自定义配置</li></ul><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -d</span><span style="--shiki-light:#005CC5;--shiki-dark:#F47067;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">--name </span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">consul</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> consul:1.13.3</span><span style="--shiki-light:#005CC5;--shiki-dark:#F47067;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">--restart=always </span><span style="--shiki-light:#005CC5;--shiki-dark:#F47067;">\\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">-p </span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">18500</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">:8500</span><span style="--shiki-light:#005CC5;--shiki-dark:#F47067;"> \\</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as o,I as r,w as c,k as l,a as d,R as g,b as C,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const T=JSON.parse('{"title":"Docker 安装 Consul 详细步骤","description":"","frontmatter":{"title":"Docker 安装 Consul 详细步骤","author":"查尔斯","date":"2022/10/27 22:00","categories":["杂碎逆袭史"],"tags":["Consul","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/27/Docker安装Consul.md","filePath":"categories/fragments/2022/10/27/Docker安装Consul.md","lastUpdated":1668325225000}'),y={name:"categories/fragments/2022/10/27/Docker安装Consul.md"},D=l("h1",{id:"docker-安装-consul-详细步骤",tabindex:"-1"},[d("Docker 安装 Consul 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-consul-详细步骤","aria-label":'Permalink to "Docker 安装 Consul 详细步骤"'},"")],-1),m=g("",17);function F(s,A,v,B,_,b){const e=p,t=k("ClientOnly");return n(),o("div",null,[D,r(t,null,{default:c(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),C(e,{key:0,article:s.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),m])}const x=h(y,[["render",F]]);export{T as __pageData,x as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as o,I as r,w as c,k as l,a as d,R as g,b as C,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const T=JSON.parse('{"title":"Docker 安装 Consul 详细步骤","description":"","frontmatter":{"title":"Docker 安装 Consul 详细步骤","author":"查尔斯","date":"2022/10/27 22:00","categories":["杂碎逆袭史"],"tags":["Consul","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/27/Docker安装Consul.md","filePath":"categories/fragments/2022/10/27/Docker安装Consul.md","lastUpdated":1668325225000}'),y={name:"categories/fragments/2022/10/27/Docker安装Consul.md"},D=l("h1",{id:"docker-安装-consul-详细步骤",tabindex:"-1"},[d("Docker 安装 Consul 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-consul-详细步骤","aria-label":'Permalink to "Docker 安装 Consul 详细步骤"'},"")],-1),m=g("",17);function F(s,A,v,B,_,b){const e=p,t=k("ClientOnly");return n(),o("div",null,[D,r(t,null,{default:c(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),C(e,{key:0,article:s.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),m])}const x=h(y,[["render",F]]);export{T as __pageData,x as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as e}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as l,a as c,R as g,b as C,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const F="/assets/202210282235156.piJI5yLy.png",D="/assets/202210282236211.o-8CIAKg.png",b=JSON.parse('{"title":"Docker 安装 MinIO 详细步骤","description":"","frontmatter":{"title":"Docker 安装 MinIO 详细步骤","author":"查尔斯","date":"2022/10/28 22:37","categories":["杂碎逆袭史"],"tags":["MinIO","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/28/Docker安装MinIO.md","filePath":"categories/fragments/2022/10/28/Docker安装MinIO.md","lastUpdated":1668604952000}'),m={name:"categories/fragments/2022/10/28/Docker安装MinIO.md"},A=l("h1",{id:"docker-安装-minio-详细步骤",tabindex:"-1"},[c("Docker 安装 MinIO 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-minio-详细步骤","aria-label":'Permalink to "Docker 安装 MinIO 详细步骤"'},"")],-1),E=g(`<div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>笔者下面的步骤及配置是基于指定版本的实践,大多数程序大多数情况下在相差不大的版本时可以直接参考。(当然了,即使是非 Docker 方式安装程序也是一样道理)</p></div><h2 id="拉取镜像" tabindex="-1">拉取镜像 <a class="header-anchor" href="#拉取镜像" aria-label="Permalink to "拉取镜像""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>拉取镜像时需要明确镜像版本(Tag)。</p></div><p>不指定版本(Tag)就拉取镜像,那拉取下来的镜像版本(Tag)默认是 <code>latest</code>(最新的)。<code>latest</code> 会跟随 Docker Registry 中的记录变化,现在拉取下来的 <code>latest</code> 是 x1 版本,但隔了一段时间后你在其他机器上再拉取 <code>latest</code> 可能就是 x2 版本了。</p><p>变化的版本,不利于生产环境部署的稳定。无论是后续在其他环境部署还是扩容集群等场景均要求根据架构要求指定好版本。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> pull</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> minio/minio:RELEASE.2022-08-02T23-59-16Z.fips</span></span></code></pre></div><h2 id="运行容器" tabindex="-1">运行容器 <a class="header-anchor" href="#运行容器" aria-label="Permalink to "运行容器""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p><strong>下方的配置,切记要根据个人实际情况来修改。</strong></p></div><ul><li>容器的名称</li><li>镜像名称:版本</li><li>是否设置自启动?</li><li>是否端口映射?</li><li>环境变量配置</li><li>映射的话映射到宿主机哪个端口?</li><li>是否挂载卷?</li><li>挂载的话要挂载宿主机哪个目录?</li><li>......</li><li>等自定义配置</li></ul><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># MINIO_ACCESS_KEY:用户名,默认为 minioadmin</span></span>
|
||||
import{_ as e}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as l,a as c,R as g,b as C,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const F="/assets/202210282235156.piJI5yLy.png",D="/assets/202210282236211.o-8CIAKg.png",b=JSON.parse('{"title":"Docker 安装 MinIO 详细步骤","description":"","frontmatter":{"title":"Docker 安装 MinIO 详细步骤","author":"查尔斯","date":"2022/10/28 22:37","categories":["杂碎逆袭史"],"tags":["MinIO","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/28/Docker安装MinIO.md","filePath":"categories/fragments/2022/10/28/Docker安装MinIO.md","lastUpdated":1668604952000}'),m={name:"categories/fragments/2022/10/28/Docker安装MinIO.md"},A=l("h1",{id:"docker-安装-minio-详细步骤",tabindex:"-1"},[c("Docker 安装 MinIO 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-minio-详细步骤","aria-label":'Permalink to "Docker 安装 MinIO 详细步骤"'},"")],-1),E=g(`<div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>笔者下面的步骤及配置是基于指定版本的实践,大多数程序大多数情况下在相差不大的版本时可以直接参考。(当然了,即使是非 Docker 方式安装程序也是一样道理)</p></div><h2 id="拉取镜像" tabindex="-1">拉取镜像 <a class="header-anchor" href="#拉取镜像" aria-label="Permalink to "拉取镜像""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>拉取镜像时需要明确镜像版本(Tag)。</p></div><p>不指定版本(Tag)就拉取镜像,那拉取下来的镜像版本(Tag)默认是 <code>latest</code>(最新的)。<code>latest</code> 会跟随 Docker Registry 中的记录变化,现在拉取下来的 <code>latest</code> 是 x1 版本,但隔了一段时间后你在其他机器上再拉取 <code>latest</code> 可能就是 x2 版本了。</p><p>变化的版本,不利于生产环境部署的稳定。无论是后续在其他环境部署还是扩容集群等场景均要求根据架构要求指定好版本。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> pull</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> minio/minio:RELEASE.2022-08-02T23-59-16Z.fips</span></span></code></pre></div><h2 id="运行容器" tabindex="-1">运行容器 <a class="header-anchor" href="#运行容器" aria-label="Permalink to "运行容器""></a></h2><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p><strong>下方的配置,切记要根据个人实际情况来修改。</strong></p></div><ul><li>容器的名称</li><li>镜像名称:版本</li><li>是否设置自启动?</li><li>是否端口映射?</li><li>环境变量配置</li><li>映射的话映射到宿主机哪个端口?</li><li>是否挂载卷?</li><li>挂载的话要挂载宿主机哪个目录?</li><li>......</li><li>等自定义配置</li></ul><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># MINIO_ACCESS_KEY:用户名,默认为 minioadmin</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># MINIO_SECRET_KEY:用户密码,默认为 minioadmin</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># MINIO_COMPRESS:开启压缩 on 开启 off 关闭</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># MINIO_COMPRESS_EXTENSIONS:扩展名 .pdf,.doc 为空 所有类型均压缩</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as e}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as l,a as c,R as g,b as C,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const F="/assets/202210282235156.piJI5yLy.png",D="/assets/202210282236211.o-8CIAKg.png",b=JSON.parse('{"title":"Docker 安装 MinIO 详细步骤","description":"","frontmatter":{"title":"Docker 安装 MinIO 详细步骤","author":"查尔斯","date":"2022/10/28 22:37","categories":["杂碎逆袭史"],"tags":["MinIO","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/28/Docker安装MinIO.md","filePath":"categories/fragments/2022/10/28/Docker安装MinIO.md","lastUpdated":1668604952000}'),m={name:"categories/fragments/2022/10/28/Docker安装MinIO.md"},A=l("h1",{id:"docker-安装-minio-详细步骤",tabindex:"-1"},[c("Docker 安装 MinIO 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-minio-详细步骤","aria-label":'Permalink to "Docker 安装 MinIO 详细步骤"'},"")],-1),E=g("",20);function _(s,u,B,I,S,M){const t=e,p=k("ClientOnly");return n(),r("div",null,[A,d(p,null,{default:o(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),C(t,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),E])}const R=h(m,[["render",_]]);export{b as __pageData,R as default};
|
||||
import{_ as e}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as l,a as c,R as g,b as C,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const F="/assets/202210282235156.piJI5yLy.png",D="/assets/202210282236211.o-8CIAKg.png",b=JSON.parse('{"title":"Docker 安装 MinIO 详细步骤","description":"","frontmatter":{"title":"Docker 安装 MinIO 详细步骤","author":"查尔斯","date":"2022/10/28 22:37","categories":["杂碎逆袭史"],"tags":["MinIO","Docker","容器"],"showComment":false},"headers":[],"relativePath":"categories/fragments/2022/10/28/Docker安装MinIO.md","filePath":"categories/fragments/2022/10/28/Docker安装MinIO.md","lastUpdated":1668604952000}'),m={name:"categories/fragments/2022/10/28/Docker安装MinIO.md"},A=l("h1",{id:"docker-安装-minio-详细步骤",tabindex:"-1"},[c("Docker 安装 MinIO 详细步骤 "),l("a",{class:"header-anchor",href:"#docker-安装-minio-详细步骤","aria-label":'Permalink to "Docker 安装 MinIO 详细步骤"'},"")],-1),E=g("",20);function _(s,u,B,I,S,M){const t=e,p=k("ClientOnly");return n(),r("div",null,[A,d(p,null,{default:o(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),C(t,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),E])}const R=h(m,[["render",_]]);export{b as __pageData,R as default};
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as o,o as e,c as k,I as d,w as r,k as t,a as c,R as g,b as F,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202210312020985.YlmMgovU.png",E=JSON.parse('{"title":"CentOS 安装 Docker、Docker Compose","description":"","frontmatter":{"title":"CentOS 安装 Docker、Docker Compose","author":"查尔斯","date":"2022/10/31 20:56","categories":["杂碎逆袭史"],"tags":["Docker","Linux","CentOS"]},"headers":[],"relativePath":"categories/fragments/2022/10/31/CentOS安装Docker.md","filePath":"categories/fragments/2022/10/31/CentOS安装Docker.md","lastUpdated":1669526061000}'),y={name:"categories/fragments/2022/10/31/CentOS安装Docker.md"},C=t("h1",{id:"centos-安装-docker、docker-compose",tabindex:"-1"},[c("CentOS 安装 Docker、Docker Compose "),t("a",{class:"header-anchor",href:"#centos-安装-docker、docker-compose","aria-label":'Permalink to "CentOS 安装 Docker、Docker Compose"'},"")],-1),D=g("",20);function v(s,b,_,A,f,B){const l=p,n=o("ClientOnly");return e(),k("div",null,[C,d(n,null,{default:r(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(e(),F(l,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),D])}const O=h(y,[["render",v]]);export{E as __pageData,O as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as o,o as e,c as k,I as d,w as r,k as t,a as c,R as g,b as F,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202210312020985.YlmMgovU.png",E=JSON.parse('{"title":"CentOS 安装 Docker、Docker Compose","description":"","frontmatter":{"title":"CentOS 安装 Docker、Docker Compose","author":"查尔斯","date":"2022/10/31 20:56","categories":["杂碎逆袭史"],"tags":["Docker","Linux","CentOS"]},"headers":[],"relativePath":"categories/fragments/2022/10/31/CentOS安装Docker.md","filePath":"categories/fragments/2022/10/31/CentOS安装Docker.md","lastUpdated":1669526061000}'),y={name:"categories/fragments/2022/10/31/CentOS安装Docker.md"},C=t("h1",{id:"centos-安装-docker、docker-compose",tabindex:"-1"},[c("CentOS 安装 Docker、Docker Compose "),t("a",{class:"header-anchor",href:"#centos-安装-docker、docker-compose","aria-label":'Permalink to "CentOS 安装 Docker、Docker Compose"'},"")],-1),D=g("",20);function v(s,b,_,A,f,B){const l=p,n=o("ClientOnly");return e(),k("div",null,[C,d(n,null,{default:r(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(e(),F(l,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),D])}const O=h(y,[["render",v]]);export{E as __pageData,O as default};
|
@@ -1,3 +1,3 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as o,o as t,c,I as d,w as h,k as i,a as _,R as g,b as k,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202211012021157.bgWhqDYj.png",I="/assets/202211012022122.RLbcysbW.png",b="/assets/202211012022222.CHaHgS3A.png",D="/assets/202211012025211.IS3h1IKu.png",M=JSON.parse('{"title":"使用 IntelliJ IDEA 进行远程程序调试","description":"","frontmatter":{"title":"使用 IntelliJ IDEA 进行远程程序调试","author":"查尔斯","date":"2022/11/01 20:55","categories":["杂碎逆袭史"],"tags":["IDE","IntelliJ IDEA","Java"]},"headers":[],"relativePath":"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md","filePath":"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md","lastUpdated":1667545308000}'),C={name:"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md"},v=i("h1",{id:"使用-intellij-idea-进行远程程序调试",tabindex:"-1"},[_("使用 IntelliJ IDEA 进行远程程序调试 "),i("a",{class:"header-anchor",href:"#使用-intellij-idea-进行远程程序调试","aria-label":'Permalink to "使用 IntelliJ IDEA 进行远程程序调试"'},"")],-1),f=g('<p><strong>C:</strong> 今天在测试环境出现了一个 “匪夷所思” 的问题,追踪日志、排查 Feign 日志,修改配置,尝试了很多种办法,均未解决。最终决定对测试环境进行远程程序调试来看看。</p><p>在开发时用 IDE 的断点调试倒是相对便捷,但到了部署好的环境,再使用 IDE 来调试,就要麻烦一些了。下面就跟着笔者来看看使用 IntelliJ IDEA 实现远程 Debug 的步骤吧。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>由于笔者安装了 [Chinese(Simplified)Language Pack / 中文语言包] 插件,所以下方步骤的 IntelliJ IDEA 界面都是中文的,各位同学如果用的是默认语言包,那就参照着看吧。</p></div><h2 id="新增远程调试配置" tabindex="-1">新增远程调试配置 <a class="header-anchor" href="#新增远程调试配置" aria-label="Permalink to "新增远程调试配置""></a></h2><p>点开运行程序下拉菜单,点击 [编辑配置...]。</p><p><img src="'+u+'" alt="202211012021157"></p><p>在打开的 [运行/调试配置] 窗口,点击左上角 [+] 号,随后在弹出的 [添加新配置] 下拉菜单中,下拉找到 [远程 JVM 调试],点击即可添加远程调试配置。</p><p><img src="'+I+'" alt="202211012022122"></p><p>按照下图序号顺序,依次设置好 [名称]、[主机]、[端口]、[JDK 版本],然后先复制一下下图红框中的 [远程 JVM 的命令行实参],点击 [确定] 完成远程调试配置添加。</p><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>这里主要就注意一下主机和端口两个配置、主机是你要远程调试的程序所在服务器的 IP/域名,但端口可不是你要远程调试的程序所占用的端口。这个端口是远程调试端口,也不能和程序端口相同。</p></div><p><img src="'+b+`" alt="202211012022222"></p><h2 id="修改启动命令" tabindex="-1">修改启动命令 <a class="header-anchor" href="#修改启动命令" aria-label="Permalink to "修改启动命令""></a></h2><p>添加完配置之后,就立刻能开始调试吗?当然不是了,很简单的问题,如果我们只需要在 IntelliJ IDEA 中配置两下就能直接连接程序调试,那 Java 程序的安全性也太低了吧。</p><p>刚才笔者让你复制的 [远程 JVM 的命令行实参],是 IntelliJ IDEA 基于我们刚才的配置帮我们生成的,我们需要将这个 JVM 命令行参数加到你要远程调试的程序启动命令中。</p><p>例如:</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as o,o as t,c,I as d,w as h,k as i,a as _,R as g,b as k,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202211012021157.bgWhqDYj.png",I="/assets/202211012022122.RLbcysbW.png",b="/assets/202211012022222.CHaHgS3A.png",D="/assets/202211012025211.IS3h1IKu.png",M=JSON.parse('{"title":"使用 IntelliJ IDEA 进行远程程序调试","description":"","frontmatter":{"title":"使用 IntelliJ IDEA 进行远程程序调试","author":"查尔斯","date":"2022/11/01 20:55","categories":["杂碎逆袭史"],"tags":["IDE","IntelliJ IDEA","Java"]},"headers":[],"relativePath":"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md","filePath":"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md","lastUpdated":1667545308000}'),C={name:"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md"},v=i("h1",{id:"使用-intellij-idea-进行远程程序调试",tabindex:"-1"},[_("使用 IntelliJ IDEA 进行远程程序调试 "),i("a",{class:"header-anchor",href:"#使用-intellij-idea-进行远程程序调试","aria-label":'Permalink to "使用 IntelliJ IDEA 进行远程程序调试"'},"")],-1),f=g('<p><strong>C:</strong> 今天在测试环境出现了一个 “匪夷所思” 的问题,追踪日志、排查 Feign 日志,修改配置,尝试了很多种办法,均未解决。最终决定对测试环境进行远程程序调试来看看。</p><p>在开发时用 IDE 的断点调试倒是相对便捷,但到了部署好的环境,再使用 IDE 来调试,就要麻烦一些了。下面就跟着笔者来看看使用 IntelliJ IDEA 实现远程 Debug 的步骤吧。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>由于笔者安装了 [Chinese(Simplified)Language Pack / 中文语言包] 插件,所以下方步骤的 IntelliJ IDEA 界面都是中文的,各位同学如果用的是默认语言包,那就参照着看吧。</p></div><h2 id="新增远程调试配置" tabindex="-1">新增远程调试配置 <a class="header-anchor" href="#新增远程调试配置" aria-label="Permalink to "新增远程调试配置""></a></h2><p>点开运行程序下拉菜单,点击 [编辑配置...]。</p><p><img src="'+u+'" alt="202211012021157"></p><p>在打开的 [运行/调试配置] 窗口,点击左上角 [+] 号,随后在弹出的 [添加新配置] 下拉菜单中,下拉找到 [远程 JVM 调试],点击即可添加远程调试配置。</p><p><img src="'+I+'" alt="202211012022122"></p><p>按照下图序号顺序,依次设置好 [名称]、[主机]、[端口]、[JDK 版本],然后先复制一下下图红框中的 [远程 JVM 的命令行实参],点击 [确定] 完成远程调试配置添加。</p><div class="warning custom-block"><p class="custom-block-title">笔者说</p><p>这里主要就注意一下主机和端口两个配置、主机是你要远程调试的程序所在服务器的 IP/域名,但端口可不是你要远程调试的程序所占用的端口。这个端口是远程调试端口,也不能和程序端口相同。</p></div><p><img src="'+b+`" alt="202211012022222"></p><h2 id="修改启动命令" tabindex="-1">修改启动命令 <a class="header-anchor" href="#修改启动命令" aria-label="Permalink to "修改启动命令""></a></h2><p>添加完配置之后,就立刻能开始调试吗?当然不是了,很简单的问题,如果我们只需要在 IntelliJ IDEA 中配置两下就能直接连接程序调试,那 Java 程序的安全性也太低了吧。</p><p>刚才笔者让你复制的 [远程 JVM 的命令行实参],是 IntelliJ IDEA 基于我们刚才的配置帮我们生成的,我们需要将这个 JVM 命令行参数加到你要远程调试的程序启动命令中。</p><p>例如:</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">java</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -jar</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> 你的程序名.jar</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --spring.profiles.active=test</span></span></code></pre></div><p>好了,还差最后一步,把你配置的远程调试端口放开。</p><h2 id="启动远程调试" tabindex="-1">启动远程调试 <a class="header-anchor" href="#启动远程调试" aria-label="Permalink to "启动远程调试""></a></h2><p>回到 IDE 中,点击 [Debug 运行] 按钮,如果控制台窗口出现下方提示,那么接下来该怎么加断点,该怎么触发断点,该怎么进行调试就不用笔者过多介绍了吧?</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># Connected to the target VM, address: ''xxx:5005', transport: 'socket''</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">已连接到目标</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> VM,地址:''xxx:5005', 传输: '套接字''</span></span></code></pre></div><p><img src="`+D+'" alt="202211012025211"></p><p>远程调试完后别忘了把远程调试端口关闭,该删除安全组规则就删除。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>哦对了,笔者这 “匪夷所思” 的问题到底解决了没有呢?当然解决了,而且这个问题不是代码的问题,而是一位远程办公的同事在他本地连接了测试环境数据库(这在笔者项目开发时强调过不允许连接),他的程序一直运行着把测试环境的一些任务数据处理了。</p><p>具体的不多说,因为当你调试时程序运行正常,断开调试再试就出错,而且在你没调试前添加的部分日志埋点也没输出时,其实就应该摒弃所谓的 “不可能”,即:程序没有在你预想的机器上运行。毕竟福尔摩斯有句话:“排除一切不可能的,剩下的即使再不可能,那也是真相”。</p></div>',23);function A(s,y,E,F,J,V){const l=p,n=o("ClientOnly");return t(),c("div",null,[v,d(n,null,{default:h(()=>{var a,e;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((e=s.$frontmatter)==null?void 0:e.showArticleMetadata)??!0)?(t(),k(l,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),f])}const S=r(C,[["render",A]]);export{M as __pageData,S as default};
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as o,o as t,c,I as d,w as h,k as i,a as _,R as g,b as k,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202211012021157.bgWhqDYj.png",I="/assets/202211012022122.RLbcysbW.png",b="/assets/202211012022222.CHaHgS3A.png",D="/assets/202211012025211.IS3h1IKu.png",M=JSON.parse('{"title":"使用 IntelliJ IDEA 进行远程程序调试","description":"","frontmatter":{"title":"使用 IntelliJ IDEA 进行远程程序调试","author":"查尔斯","date":"2022/11/01 20:55","categories":["杂碎逆袭史"],"tags":["IDE","IntelliJ IDEA","Java"]},"headers":[],"relativePath":"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md","filePath":"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md","lastUpdated":1667545308000}'),C={name:"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md"},v=i("h1",{id:"使用-intellij-idea-进行远程程序调试",tabindex:"-1"},[_("使用 IntelliJ IDEA 进行远程程序调试 "),i("a",{class:"header-anchor",href:"#使用-intellij-idea-进行远程程序调试","aria-label":'Permalink to "使用 IntelliJ IDEA 进行远程程序调试"'},"")],-1),f=g("",23);function A(s,y,E,F,J,V){const l=p,n=o("ClientOnly");return t(),c("div",null,[v,d(n,null,{default:h(()=>{var a,e;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((e=s.$frontmatter)==null?void 0:e.showArticleMetadata)??!0)?(t(),k(l,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),f])}const S=r(C,[["render",A]]);export{M as __pageData,S as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as o,o as t,c,I as d,w as h,k as i,a as _,R as g,b as k,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202211012021157.bgWhqDYj.png",I="/assets/202211012022122.RLbcysbW.png",b="/assets/202211012022222.CHaHgS3A.png",D="/assets/202211012025211.IS3h1IKu.png",M=JSON.parse('{"title":"使用 IntelliJ IDEA 进行远程程序调试","description":"","frontmatter":{"title":"使用 IntelliJ IDEA 进行远程程序调试","author":"查尔斯","date":"2022/11/01 20:55","categories":["杂碎逆袭史"],"tags":["IDE","IntelliJ IDEA","Java"]},"headers":[],"relativePath":"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md","filePath":"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md","lastUpdated":1667545308000}'),C={name:"categories/fragments/2022/11/01/使用IDEA进行远程程序调试.md"},v=i("h1",{id:"使用-intellij-idea-进行远程程序调试",tabindex:"-1"},[_("使用 IntelliJ IDEA 进行远程程序调试 "),i("a",{class:"header-anchor",href:"#使用-intellij-idea-进行远程程序调试","aria-label":'Permalink to "使用 IntelliJ IDEA 进行远程程序调试"'},"")],-1),f=g("",23);function A(s,y,E,F,J,V){const l=p,n=o("ClientOnly");return t(),c("div",null,[v,d(n,null,{default:h(()=>{var a,e;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((e=s.$frontmatter)==null?void 0:e.showArticleMetadata)??!0)?(t(),k(l,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),f])}const S=r(C,[["render",A]]);export{M as __pageData,S as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as n}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as t,c as r,I as d,w as C,k as l,a as g,R as o,b as c,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const A="/assets/202212072131211.Jo_BrZ2Z.png",F="/assets/202212072131521.yb7Q3N-g.png",B="/assets/202212072132211.i2qAmRnF.png",D="/assets/202212072132521.PBrQjFUh.png",m="/assets/202212072135211.GdzZoObV.png",q=JSON.parse('{"title":"简单聊聊如何让网站开启灰色显示","description":"","frontmatter":{"title":"简单聊聊如何让网站开启灰色显示","author":"查尔斯","date":"2022/12/07 21:37","categories":["杂碎逆袭史"],"tags":["CSS","前端"]},"headers":[],"relativePath":"categories/fragments/2022/12/07/网站开启灰色显示.md","filePath":"categories/fragments/2022/12/07/网站开启灰色显示.md","lastUpdated":1670428158000}'),E={name:"categories/fragments/2022/12/07/网站开启灰色显示.md"},u=l("h1",{id:"简单聊聊如何让网站开启灰色显示",tabindex:"-1"},[g("简单聊聊如何让网站开启灰色显示 "),l("a",{class:"header-anchor",href:"#简单聊聊如何让网站开启灰色显示","aria-label":'Permalink to "简单聊聊如何让网站开启灰色显示"'},"")],-1),f=o('<p><strong>C:</strong> 在一些特殊的日子里,为了表达哀思和悼念,除禁娱之外,各网站会将首页或者全站在特定时间内以灰色显示。本篇,笔者就来和各位同学简单聊聊,如何让我们的网站以灰色显示。</p><p><img src="'+A+'" alt="202212072131211"></p><h2 id="源码解析-掘金" tabindex="-1">源码解析-掘金 <a class="header-anchor" href="#源码解析-掘金" aria-label="Permalink to "源码解析-掘金""></a></h2><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>作为一个技术行业从业者,对技术要时刻保持好奇心。</p></div><p>笔者虽然是一个后端开发者,但平时在网页或 APP 上遇到一些用心的效果时,也会停下来想想,在方便的情况下也会简单探究一下。既然各网站都开启了灰色显示,想要知道它们怎么实现的,那就随便找几个网站和笔者一起来看看吧。</p><p>进入掘金首页,按下 [Fn] + F12,打开开发者工具,切换到 [Elements] 选项卡,毕竟是全局性的效果,所以我们要找的”目标“ 也很明显,在 <code><html></code> 标签上,有一个叫 <code>gray-mode</code> 的类,从字面意思(灰色模式)就可以猜到它的作用。</p><p><img src="'+F+`" alt="202212072131521"></p><p><code>gray-mode</code> 类的样式代码如下:</p><div class="language-css vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">css</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">html</span><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;">.gray-mode</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
||||
import{_ as n}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as t,c as r,I as d,w as C,k as l,a as g,R as o,b as c,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const A="/assets/202212072131211.Jo_BrZ2Z.png",F="/assets/202212072131521.yb7Q3N-g.png",B="/assets/202212072132211.i2qAmRnF.png",D="/assets/202212072132521.PBrQjFUh.png",m="/assets/202212072135211.GdzZoObV.png",q=JSON.parse('{"title":"简单聊聊如何让网站开启灰色显示","description":"","frontmatter":{"title":"简单聊聊如何让网站开启灰色显示","author":"查尔斯","date":"2022/12/07 21:37","categories":["杂碎逆袭史"],"tags":["CSS","前端"]},"headers":[],"relativePath":"categories/fragments/2022/12/07/网站开启灰色显示.md","filePath":"categories/fragments/2022/12/07/网站开启灰色显示.md","lastUpdated":1670428158000}'),E={name:"categories/fragments/2022/12/07/网站开启灰色显示.md"},u=l("h1",{id:"简单聊聊如何让网站开启灰色显示",tabindex:"-1"},[g("简单聊聊如何让网站开启灰色显示 "),l("a",{class:"header-anchor",href:"#简单聊聊如何让网站开启灰色显示","aria-label":'Permalink to "简单聊聊如何让网站开启灰色显示"'},"")],-1),f=o('<p><strong>C:</strong> 在一些特殊的日子里,为了表达哀思和悼念,除禁娱之外,各网站会将首页或者全站在特定时间内以灰色显示。本篇,笔者就来和各位同学简单聊聊,如何让我们的网站以灰色显示。</p><p><img src="'+A+'" alt="202212072131211"></p><h2 id="源码解析-掘金" tabindex="-1">源码解析-掘金 <a class="header-anchor" href="#源码解析-掘金" aria-label="Permalink to "源码解析-掘金""></a></h2><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>作为一个技术行业从业者,对技术要时刻保持好奇心。</p></div><p>笔者虽然是一个后端开发者,但平时在网页或 APP 上遇到一些用心的效果时,也会停下来想想,在方便的情况下也会简单探究一下。既然各网站都开启了灰色显示,想要知道它们怎么实现的,那就随便找几个网站和笔者一起来看看吧。</p><p>进入掘金首页,按下 [Fn] + F12,打开开发者工具,切换到 [Elements] 选项卡,毕竟是全局性的效果,所以我们要找的”目标“ 也很明显,在 <code><html></code> 标签上,有一个叫 <code>gray-mode</code> 的类,从字面意思(灰色模式)就可以猜到它的作用。</p><p><img src="'+F+`" alt="202212072131521"></p><p><code>gray-mode</code> 类的样式代码如下:</p><div class="language-css vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">css</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">html</span><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;">.gray-mode</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> filter</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">grayscale</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">.95</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -webkit-filter</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">grayscale</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">.95</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">); </span><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/* webkit */</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">}</span></span></code></pre></div><p>很简单的代码 <code>filter: grayscale(.95);</code>,只需要这一行代码即可,第二行代码是为了保障浏览器兼容性而添加的。</p><p>首先简单认识一下 filter 属性。</p><div class="tip custom-block"><p class="custom-block-title">Web开发技术/CSS/filter(滤镜)</p><p>CSS 属性 filter 将模糊或颜色偏移等图形效果应用于元素。滤镜通常用于调整图像、背景和边框的渲染。[1]</p></div><p>然后我们再来认识一下 <code>grayscale()</code> 函数。</p><div class="tip custom-block"><p class="custom-block-title">Web开发技术/CSS/filter/函数:grayscale()</p><p>使用 CSS 滤镜属性时,你需要设定下面某一函数的值。如果该值无效,函数返回 none。除特殊说明外,函数的值如果接受百分比值(如 34%),那么该函数也接受小数值(如 0.34)。</p><p><code>grayscale(amount)</code> 函数将改变输入图像灰度。amount 的值定义了转换的比例。值为 100% 则完全转为灰度图像,值为 0% 图像无变化。值在 0% 到 100% 之间,则是效果的线性乘数。若未设置值,默认是 0。[1]</p></div><p>介绍的已经很直白了,我们再简单来说一下,<code>filter: grayscale(.95);</code> 这行代码的作用就是将网页中所有的元素转换为灰色显示,<code>.95</code> 就是 <code>95%</code> 的灰度,没有完全转为灰色也是为了护眼,增强一些用户体验。</p><h2 id="源码分析-b站" tabindex="-1">源码分析-B站 <a class="header-anchor" href="#源码分析-b站" aria-label="Permalink to "源码分析-B站""></a></h2><p>我们再来看一个网站:B站,同样开启了灰色显示。略有不同的是 B 站的整体感观更舒服一些,没有那么刺眼,一些颜色也能分辨出来。</p><p><img src="`+B+'" alt="202212072132211"></p><p>那咱们也别啰嗦。</p><div class="tip custom-block"><p class="custom-block-title">Linus Torvalds</p><p>Talk is cheap. Show me the code.(废话少说。放码过来。)</p></div><p>依然很快就找到了“目标”,在 <code><html></code> 标签上,有一个叫 <code>gray</code> 的类。</p><p><img src="'+D+`" alt="202212072132521"></p><p><code>gray</code> 类的样式代码如下:</p><div class="language-css vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">css</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">html</span><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;">.gray</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as n}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as t,c as r,I as d,w as C,k as l,a as g,R as o,b as c,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const A="/assets/202212072131211.Jo_BrZ2Z.png",F="/assets/202212072131521.yb7Q3N-g.png",B="/assets/202212072132211.i2qAmRnF.png",D="/assets/202212072132521.PBrQjFUh.png",m="/assets/202212072135211.GdzZoObV.png",q=JSON.parse('{"title":"简单聊聊如何让网站开启灰色显示","description":"","frontmatter":{"title":"简单聊聊如何让网站开启灰色显示","author":"查尔斯","date":"2022/12/07 21:37","categories":["杂碎逆袭史"],"tags":["CSS","前端"]},"headers":[],"relativePath":"categories/fragments/2022/12/07/网站开启灰色显示.md","filePath":"categories/fragments/2022/12/07/网站开启灰色显示.md","lastUpdated":1670428158000}'),E={name:"categories/fragments/2022/12/07/网站开启灰色显示.md"},u=l("h1",{id:"简单聊聊如何让网站开启灰色显示",tabindex:"-1"},[g("简单聊聊如何让网站开启灰色显示 "),l("a",{class:"header-anchor",href:"#简单聊聊如何让网站开启灰色显示","aria-label":'Permalink to "简单聊聊如何让网站开启灰色显示"'},"")],-1),f=o("",36);function _(s,b,v,S,w,x){const h=n,k=e("ClientOnly");return t(),r("div",null,[u,d(k,null,{default:C(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),c(h,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),f])}const V=p(E,[["render",_]]);export{q as __pageData,V as default};
|
||||
import{_ as n}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as t,c as r,I as d,w as C,k as l,a as g,R as o,b as c,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const A="/assets/202212072131211.Jo_BrZ2Z.png",F="/assets/202212072131521.yb7Q3N-g.png",B="/assets/202212072132211.i2qAmRnF.png",D="/assets/202212072132521.PBrQjFUh.png",m="/assets/202212072135211.GdzZoObV.png",q=JSON.parse('{"title":"简单聊聊如何让网站开启灰色显示","description":"","frontmatter":{"title":"简单聊聊如何让网站开启灰色显示","author":"查尔斯","date":"2022/12/07 21:37","categories":["杂碎逆袭史"],"tags":["CSS","前端"]},"headers":[],"relativePath":"categories/fragments/2022/12/07/网站开启灰色显示.md","filePath":"categories/fragments/2022/12/07/网站开启灰色显示.md","lastUpdated":1670428158000}'),E={name:"categories/fragments/2022/12/07/网站开启灰色显示.md"},u=l("h1",{id:"简单聊聊如何让网站开启灰色显示",tabindex:"-1"},[g("简单聊聊如何让网站开启灰色显示 "),l("a",{class:"header-anchor",href:"#简单聊聊如何让网站开启灰色显示","aria-label":'Permalink to "简单聊聊如何让网站开启灰色显示"'},"")],-1),f=o("",36);function _(s,b,v,S,w,x){const h=n,k=e("ClientOnly");return t(),r("div",null,[u,d(k,null,{default:C(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),c(h,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),f])}const V=p(E,[["render",_]]);export{q as __pageData,V as default};
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as r,I as d,w as g,k as l,a as A,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const o="/assets/202301062024211.XSdkEyRK.png",c="/assets/202301062027985.qIIuam8H.png",S=JSON.parse('{"title":"阿里巴巴的Code Review方法论与实践总结","description":"","frontmatter":{"title":"阿里巴巴的Code Review方法论与实践总结","isOriginal":false,"author":"方基成(润甫)","date":"2023/01/06 20:12","articleTitle":"一文梳理Code Review方法论与实践总结","articleLink":"https://mp.weixin.qq.com/s/_4MFrQSYOIGYRdDGOJPDKQ","categories":["杂碎逆袭史"],"tags":["Code Review","卓越工程文化"]},"headers":[],"relativePath":"categories/fragments/2023/01/06/CodeReview方法论与实践总结.md","filePath":"categories/fragments/2023/01/06/CodeReview方法论与实践总结.md","lastUpdated":1673010072000}'),B={name:"categories/fragments/2023/01/06/CodeReview方法论与实践总结.md"},F=l("h1",{id:"阿里巴巴的code-review方法论与实践总结",tabindex:"-1"},[A("阿里巴巴的Code Review方法论与实践总结 "),l("a",{class:"header-anchor",href:"#阿里巴巴的code-review方法论与实践总结","aria-label":'Permalink to "阿里巴巴的Code Review方法论与实践总结"'},"")],-1),E=D("",68);function u(s,b,v,m,q,O){const h=p,t=e("ClientOnly");return n(),r("div",null,[F,d(t,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(h,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),E])}const P=k(B,[["render",u]]);export{S as __pageData,P as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as r,I as d,w as g,k as l,a as A,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const o="/assets/202301062024211.XSdkEyRK.png",c="/assets/202301062027985.qIIuam8H.png",S=JSON.parse('{"title":"阿里巴巴的Code Review方法论与实践总结","description":"","frontmatter":{"title":"阿里巴巴的Code Review方法论与实践总结","isOriginal":false,"author":"方基成(润甫)","date":"2023/01/06 20:12","articleTitle":"一文梳理Code Review方法论与实践总结","articleLink":"https://mp.weixin.qq.com/s/_4MFrQSYOIGYRdDGOJPDKQ","categories":["杂碎逆袭史"],"tags":["Code Review","卓越工程文化"]},"headers":[],"relativePath":"categories/fragments/2023/01/06/CodeReview方法论与实践总结.md","filePath":"categories/fragments/2023/01/06/CodeReview方法论与实践总结.md","lastUpdated":1673010072000}'),B={name:"categories/fragments/2023/01/06/CodeReview方法论与实践总结.md"},F=l("h1",{id:"阿里巴巴的code-review方法论与实践总结",tabindex:"-1"},[A("阿里巴巴的Code Review方法论与实践总结 "),l("a",{class:"header-anchor",href:"#阿里巴巴的code-review方法论与实践总结","aria-label":'Permalink to "阿里巴巴的Code Review方法论与实践总结"'},"")],-1),E=y("",68);function u(s,b,v,m,q,O){const h=p,t=e("ClientOnly");return n(),r("div",null,[F,d(t,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),D(h,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),E])}const P=k(B,[["render",u]]);export{S as __pageData,P as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as t}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202312212227123.ugL3C5bJ.png",o="/assets/202312212228233.TWHyUSD4.png",c="/assets/202312212230256.oJFSejs4.png",F="/assets/202312212231916.tBev-ybv.png",E="/assets/202312212232922.n1-YwFqg.png",u="/assets/202312212234232.oRdzZu3T.png",m="/assets/202312212235127.7sH7Ci5f.png",j=JSON.parse('{"title":"一文详解限流接口实现","description":"","frontmatter":{"title":"一文详解限流接口实现","isOriginal":false,"author":"非有","date":"2023/12/21 22:25","articleTitle":"一文详解 Java 限流接口实现","articleLink":"https://mp.weixin.qq.com/s/A5VYjstIDeVvizNK2HkrTQ","categories":["杂碎逆袭史"],"tags":["Java","限流"]},"headers":[],"relativePath":"categories/fragments/2023/12/21/一文详解限流接口实现.md","filePath":"categories/fragments/2023/12/21/一文详解限流接口实现.md","lastUpdated":1703257070000}'),q={name:"categories/fragments/2023/12/21/一文详解限流接口实现.md"},b=h("h1",{id:"一文详解限流接口实现",tabindex:"-1"},[g("一文详解限流接口实现 "),h("a",{class:"header-anchor",href:"#一文详解限流接口实现","aria-label":'Permalink to "一文详解限流接口实现"'},"")],-1),f=y('<p>本文介绍的实现方式属于应用级限制,应用级限流方式只是单应用内的请求限流,不能进行全局限流。要保证系统的抗压能力,限流是一个必不可少的环节,虽然可能会造成某些用户的请求被丢弃,但相比于突发流量造成的系统宕机来说,这些损失一般都在可以接受的范围之内。。</p><h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><h3 id="为什么要进行限流" tabindex="-1">为什么要进行限流? <a class="header-anchor" href="#为什么要进行限流" aria-label="Permalink to "为什么要进行限流?""></a></h3><ul><li><p>瞬时流量过高,服务被压垮?</p></li><li><p>恶意用户高频光顾,导致服务器宕机?</p></li><li><p>消息消费过快,导致数据库压力过大,性能下降甚至崩溃?</p><p>……</p></li></ul><h3 id="什么是限流" tabindex="-1">什么是限流? <a class="header-anchor" href="#什么是限流" aria-label="Permalink to "什么是限流?""></a></h3><div class="tip custom-block"><p class="custom-block-title">什么是限流</p><p>限流是对某一时间窗口内的请求数进行限制,保持系统的可用性和稳定性,防止因流量暴增而导致的系统运行缓慢或宕机。</p></div><p>在高并发系统中,出于系统保护角度考虑,通常会对流量进行限流。在分布式系统中,高并发场景下,为了防止系统因突然的流量激增而导致的崩溃,同时保证服务的高可用性和稳定性,限流是最常用的手段。</p><h3 id="有哪些限流算法" tabindex="-1">有哪些限流算法? <a class="header-anchor" href="#有哪些限流算法" aria-label="Permalink to "有哪些限流算法?""></a></h3><p>常见的四种限流算法,分别是:固定窗口算法、滑动窗口算法、漏桶算法、令牌桶算法。</p><h2 id="限流算法" tabindex="-1">限流算法 <a class="header-anchor" href="#限流算法" aria-label="Permalink to "限流算法""></a></h2><h3 id="固定窗口" tabindex="-1">固定窗口 <a class="header-anchor" href="#固定窗口" aria-label="Permalink to "固定窗口""></a></h3><p>固定窗口又称固定窗口(又称计数器算法,Fixed Window)限流算法,是最简单的限流算法。</p><h4 id="实现原理" tabindex="-1">实现原理 <a class="header-anchor" href="#实现原理" aria-label="Permalink to "实现原理""></a></h4><p>在指定周期内累加访问次数,当访问次数达到设定的阈值时,触发限流策略,当进入下一个时间周期时进行访问次数的清零。如图所示,我们要求3秒内的请求不要超过150次:</p><p><img src="'+B+`" alt="202312212227123"></p><h4 id="代码实现" tabindex="-1">代码实现 <a class="header-anchor" href="#代码实现" aria-label="Permalink to "代码实现""></a></h4><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">public</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> FixedWindowRateLimiter</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
||||
import{_ as t}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202312212227123.ugL3C5bJ.png",o="/assets/202312212228233.TWHyUSD4.png",c="/assets/202312212230256.oJFSejs4.png",F="/assets/202312212231916.tBev-ybv.png",E="/assets/202312212232922.n1-YwFqg.png",u="/assets/202312212234232.oRdzZu3T.png",m="/assets/202312212235127.7sH7Ci5f.png",j=JSON.parse('{"title":"一文详解限流接口实现","description":"","frontmatter":{"title":"一文详解限流接口实现","isOriginal":false,"author":"非有","date":"2023/12/21 22:25","articleTitle":"一文详解 Java 限流接口实现","articleLink":"https://mp.weixin.qq.com/s/A5VYjstIDeVvizNK2HkrTQ","categories":["杂碎逆袭史"],"tags":["Java","限流"]},"headers":[],"relativePath":"categories/fragments/2023/12/21/一文详解限流接口实现.md","filePath":"categories/fragments/2023/12/21/一文详解限流接口实现.md","lastUpdated":1703257070000}'),q={name:"categories/fragments/2023/12/21/一文详解限流接口实现.md"},b=h("h1",{id:"一文详解限流接口实现",tabindex:"-1"},[g("一文详解限流接口实现 "),h("a",{class:"header-anchor",href:"#一文详解限流接口实现","aria-label":'Permalink to "一文详解限流接口实现"'},"")],-1),f=y('<p>本文介绍的实现方式属于应用级限制,应用级限流方式只是单应用内的请求限流,不能进行全局限流。要保证系统的抗压能力,限流是一个必不可少的环节,虽然可能会造成某些用户的请求被丢弃,但相比于突发流量造成的系统宕机来说,这些损失一般都在可以接受的范围之内。。</p><h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><h3 id="为什么要进行限流" tabindex="-1">为什么要进行限流? <a class="header-anchor" href="#为什么要进行限流" aria-label="Permalink to "为什么要进行限流?""></a></h3><ul><li><p>瞬时流量过高,服务被压垮?</p></li><li><p>恶意用户高频光顾,导致服务器宕机?</p></li><li><p>消息消费过快,导致数据库压力过大,性能下降甚至崩溃?</p><p>……</p></li></ul><h3 id="什么是限流" tabindex="-1">什么是限流? <a class="header-anchor" href="#什么是限流" aria-label="Permalink to "什么是限流?""></a></h3><div class="tip custom-block"><p class="custom-block-title">什么是限流</p><p>限流是对某一时间窗口内的请求数进行限制,保持系统的可用性和稳定性,防止因流量暴增而导致的系统运行缓慢或宕机。</p></div><p>在高并发系统中,出于系统保护角度考虑,通常会对流量进行限流。在分布式系统中,高并发场景下,为了防止系统因突然的流量激增而导致的崩溃,同时保证服务的高可用性和稳定性,限流是最常用的手段。</p><h3 id="有哪些限流算法" tabindex="-1">有哪些限流算法? <a class="header-anchor" href="#有哪些限流算法" aria-label="Permalink to "有哪些限流算法?""></a></h3><p>常见的四种限流算法,分别是:固定窗口算法、滑动窗口算法、漏桶算法、令牌桶算法。</p><h2 id="限流算法" tabindex="-1">限流算法 <a class="header-anchor" href="#限流算法" aria-label="Permalink to "限流算法""></a></h2><h3 id="固定窗口" tabindex="-1">固定窗口 <a class="header-anchor" href="#固定窗口" aria-label="Permalink to "固定窗口""></a></h3><p>固定窗口又称固定窗口(又称计数器算法,Fixed Window)限流算法,是最简单的限流算法。</p><h4 id="实现原理" tabindex="-1">实现原理 <a class="header-anchor" href="#实现原理" aria-label="Permalink to "实现原理""></a></h4><p>在指定周期内累加访问次数,当访问次数达到设定的阈值时,触发限流策略,当进入下一个时间周期时进行访问次数的清零。如图所示,我们要求3秒内的请求不要超过150次:</p><p><img src="'+B+`" alt="202312212227123"></p><h4 id="代码实现" tabindex="-1">代码实现 <a class="header-anchor" href="#代码实现" aria-label="Permalink to "代码实现""></a></h4><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">public</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> FixedWindowRateLimiter</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> Logger</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> logger</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> LoggerFactory.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">getLogger</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(FixedWindowRateLimiter.class);</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> // 时间窗口大小,单位毫秒</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> long</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> windowSize;</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as t}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202312212227123.ugL3C5bJ.png",o="/assets/202312212228233.TWHyUSD4.png",c="/assets/202312212230256.oJFSejs4.png",F="/assets/202312212231916.tBev-ybv.png",E="/assets/202312212232922.n1-YwFqg.png",u="/assets/202312212234232.oRdzZu3T.png",m="/assets/202312212235127.7sH7Ci5f.png",j=JSON.parse('{"title":"一文详解限流接口实现","description":"","frontmatter":{"title":"一文详解限流接口实现","isOriginal":false,"author":"非有","date":"2023/12/21 22:25","articleTitle":"一文详解 Java 限流接口实现","articleLink":"https://mp.weixin.qq.com/s/A5VYjstIDeVvizNK2HkrTQ","categories":["杂碎逆袭史"],"tags":["Java","限流"]},"headers":[],"relativePath":"categories/fragments/2023/12/21/一文详解限流接口实现.md","filePath":"categories/fragments/2023/12/21/一文详解限流接口实现.md","lastUpdated":1703257070000}'),q={name:"categories/fragments/2023/12/21/一文详解限流接口实现.md"},b=h("h1",{id:"一文详解限流接口实现",tabindex:"-1"},[g("一文详解限流接口实现 "),h("a",{class:"header-anchor",href:"#一文详解限流接口实现","aria-label":'Permalink to "一文详解限流接口实现"'},"")],-1),f=y("",98);function v(s,w,_,L,x,S){const l=t,k=e("ClientOnly");return n(),r("div",null,[b,d(k,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),D(l,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),f])}const z=p(q,[["render",v]]);export{j as __pageData,z as default};
|
||||
import{_ as t}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202312212227123.ugL3C5bJ.png",o="/assets/202312212228233.TWHyUSD4.png",c="/assets/202312212230256.oJFSejs4.png",F="/assets/202312212231916.tBev-ybv.png",E="/assets/202312212232922.n1-YwFqg.png",u="/assets/202312212234232.oRdzZu3T.png",m="/assets/202312212235127.7sH7Ci5f.png",j=JSON.parse('{"title":"一文详解限流接口实现","description":"","frontmatter":{"title":"一文详解限流接口实现","isOriginal":false,"author":"非有","date":"2023/12/21 22:25","articleTitle":"一文详解 Java 限流接口实现","articleLink":"https://mp.weixin.qq.com/s/A5VYjstIDeVvizNK2HkrTQ","categories":["杂碎逆袭史"],"tags":["Java","限流"]},"headers":[],"relativePath":"categories/fragments/2023/12/21/一文详解限流接口实现.md","filePath":"categories/fragments/2023/12/21/一文详解限流接口实现.md","lastUpdated":1703257070000}'),q={name:"categories/fragments/2023/12/21/一文详解限流接口实现.md"},b=h("h1",{id:"一文详解限流接口实现",tabindex:"-1"},[g("一文详解限流接口实现 "),h("a",{class:"header-anchor",href:"#一文详解限流接口实现","aria-label":'Permalink to "一文详解限流接口实现"'},"")],-1),f=y("",98);function v(s,w,_,L,x,S){const l=t,k=e("ClientOnly");return n(),r("div",null,[b,d(k,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),D(l,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),f])}const z=p(q,[["render",v]]);export{j as __pageData,z as default};
|
@@ -1 +1 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as c,D as i,o as s,c as d,I as m,w as p,k as e,a as _,b as f,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"\\"杂碎\\"逆袭史","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/fragments/index.md","filePath":"categories/fragments/index.md","lastUpdated":1660643589000}'),h={name:"categories/fragments/index.md"},k=e("h1",{id:"杂碎-逆袭史",tabindex:"-1"},[_('"杂碎"逆袭史 '),e("a",{class:"header-anchor",href:"#杂碎-逆袭史","aria-label":'Permalink to ""杂碎"逆袭史"'},"")],-1),g=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,"碎片化知识的时代,纵然知晓不成体系的知识仅仅只能积累经验,却无法有效提升,但身在其中还是要如此,记录碎片知识,留作备忘。说不定后面还有机会 “把点连成线”。")],-1);function x(t,$,C,b,w,N){const n=l,r=i("ClientOnly");return s(),d("div",null,[k,m(r,null,{default:p(()=>{var a,o;return[(((a=t.$frontmatter)==null?void 0:a.aside)??!0)&&(((o=t.$frontmatter)==null?void 0:o.showArticleMetadata)??!0)?(s(),f(n,{key:0,article:t.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),g])}const A=c(h,[["render",x]]);export{y as __pageData,A as default};
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as c,D as i,o as s,c as d,I as m,w as p,k as e,a as _,b as f,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"\\"杂碎\\"逆袭史","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/fragments/index.md","filePath":"categories/fragments/index.md","lastUpdated":1660643589000}'),h={name:"categories/fragments/index.md"},k=e("h1",{id:"杂碎-逆袭史",tabindex:"-1"},[_('"杂碎"逆袭史 '),e("a",{class:"header-anchor",href:"#杂碎-逆袭史","aria-label":'Permalink to ""杂碎"逆袭史"'},"")],-1),g=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,"碎片化知识的时代,纵然知晓不成体系的知识仅仅只能积累经验,却无法有效提升,但身在其中还是要如此,记录碎片知识,留作备忘。说不定后面还有机会 “把点连成线”。")],-1);function x(t,$,C,b,w,N){const n=l,r=i("ClientOnly");return s(),d("div",null,[k,m(r,null,{default:p(()=>{var a,o;return[(((a=t.$frontmatter)==null?void 0:a.aside)??!0)&&(((o=t.$frontmatter)==null?void 0:o.showArticleMetadata)??!0)?(s(),f(n,{key:0,article:t.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),g])}const A=c(h,[["render",x]]);export{y as __pageData,A as default};
|
@@ -1 +1 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as c,D as i,o as s,c as d,I as m,w as p,k as e,a as _,b as f,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"\\"杂碎\\"逆袭史","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/fragments/index.md","filePath":"categories/fragments/index.md","lastUpdated":1660643589000}'),h={name:"categories/fragments/index.md"},k=e("h1",{id:"杂碎-逆袭史",tabindex:"-1"},[_('"杂碎"逆袭史 '),e("a",{class:"header-anchor",href:"#杂碎-逆袭史","aria-label":'Permalink to ""杂碎"逆袭史"'},"")],-1),g=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,"碎片化知识的时代,纵然知晓不成体系的知识仅仅只能积累经验,却无法有效提升,但身在其中还是要如此,记录碎片知识,留作备忘。说不定后面还有机会 “把点连成线”。")],-1);function x(t,$,C,b,w,N){const n=l,r=i("ClientOnly");return s(),d("div",null,[k,m(r,null,{default:p(()=>{var a,o;return[(((a=t.$frontmatter)==null?void 0:a.aside)??!0)&&(((o=t.$frontmatter)==null?void 0:o.showArticleMetadata)??!0)?(s(),f(n,{key:0,article:t.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),g])}const A=c(h,[["render",x]]);export{y as __pageData,A as default};
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as c,D as i,o as s,c as d,I as m,w as p,k as e,a as _,b as f,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"\\"杂碎\\"逆袭史","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/fragments/index.md","filePath":"categories/fragments/index.md","lastUpdated":1660643589000}'),h={name:"categories/fragments/index.md"},k=e("h1",{id:"杂碎-逆袭史",tabindex:"-1"},[_('"杂碎"逆袭史 '),e("a",{class:"header-anchor",href:"#杂碎-逆袭史","aria-label":'Permalink to ""杂碎"逆袭史"'},"")],-1),g=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,"碎片化知识的时代,纵然知晓不成体系的知识仅仅只能积累经验,却无法有效提升,但身在其中还是要如此,记录碎片知识,留作备忘。说不定后面还有机会 “把点连成线”。")],-1);function x(t,$,C,b,w,N){const n=l,r=i("ClientOnly");return s(),d("div",null,[k,m(r,null,{default:p(()=>{var a,o;return[(((a=t.$frontmatter)==null?void 0:a.aside)??!0)&&(((o=t.$frontmatter)==null?void 0:o.showArticleMetadata)??!0)?(s(),f(n,{key:0,article:t.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),g])}const A=c(h,[["render",x]]);export{y as __pageData,A as default};
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as h,o as e,c as o,I as c,w as d,k as t,a as k,R as g,b as _,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202112012236800.bcV6cREo.png",C="/assets/202112012236805.dadjq48q.jpeg",y="/assets/202112012236810.DUSwV3aB.png",F="/assets/202209211547666.87va370l.png",D="/assets/202209211548777.WI3TpfR2.png",b="/assets/202209211550888.-IrPxOPZ.png",A="/assets/202209211550999.QkZYUP4W.png",M=JSON.parse('{"title":"F:\\\\ 上的回收站已损坏。是否清空该驱动器上的\\"回收站\\"?","description":"","frontmatter":{"title":"F:\\\\ 上的回收站已损坏。是否清空该驱动器上的\\"回收站\\"?","author":"查尔斯","date":"2021/12/01 22:36","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2021/12/01/F盘上的回收站已损坏。是否清空该驱动器上的回收站.md","filePath":"categories/issues/2021/12/01/F盘上的回收站已损坏。是否清空该驱动器上的回收站.md","lastUpdated":1663747241000}'),q={name:"categories/issues/2021/12/01/F盘上的回收站已损坏。是否清空该驱动器上的回收站.md"},f=t("h1",{id:"f-上的回收站已损坏。是否清空该驱动器上的-回收站",tabindex:"-1"},[k('F:\\ 上的回收站已损坏。是否清空该驱动器上的"回收站"? '),t("a",{class:"header-anchor",href:"#f-上的回收站已损坏。是否清空该驱动器上的-回收站","aria-label":'Permalink to "F:\\ 上的回收站已损坏。是否清空该驱动器上的"回收站"?"'},"")],-1),v=g("",42);function P(s,E,B,S,x,N){const l=p,n=h("ClientOnly");return e(),o("div",null,[f,c(n,null,{default:d(()=>{var a,i;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((i=s.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(e(),_(l,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),v])}const T=r(q,[["render",P]]);export{M as __pageData,T as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as h,o as e,c as o,I as c,w as d,k as t,a as k,R as g,b as _,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202112012236800.bcV6cREo.png",C="/assets/202112012236805.dadjq48q.jpeg",y="/assets/202112012236810.DUSwV3aB.png",F="/assets/202209211547666.87va370l.png",D="/assets/202209211548777.WI3TpfR2.png",b="/assets/202209211550888.-IrPxOPZ.png",A="/assets/202209211550999.QkZYUP4W.png",M=JSON.parse('{"title":"F:\\\\ 上的回收站已损坏。是否清空该驱动器上的\\"回收站\\"?","description":"","frontmatter":{"title":"F:\\\\ 上的回收站已损坏。是否清空该驱动器上的\\"回收站\\"?","author":"查尔斯","date":"2021/12/01 22:36","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2021/12/01/F盘上的回收站已损坏。是否清空该驱动器上的回收站.md","filePath":"categories/issues/2021/12/01/F盘上的回收站已损坏。是否清空该驱动器上的回收站.md","lastUpdated":1663747241000}'),q={name:"categories/issues/2021/12/01/F盘上的回收站已损坏。是否清空该驱动器上的回收站.md"},f=t("h1",{id:"f-上的回收站已损坏。是否清空该驱动器上的-回收站",tabindex:"-1"},[k('F:\\ 上的回收站已损坏。是否清空该驱动器上的"回收站"? '),t("a",{class:"header-anchor",href:"#f-上的回收站已损坏。是否清空该驱动器上的-回收站","aria-label":'Permalink to "F:\\ 上的回收站已损坏。是否清空该驱动器上的"回收站"?"'},"")],-1),v=g("",42);function P(s,E,B,S,x,N){const l=p,n=h("ClientOnly");return e(),o("div",null,[f,c(n,null,{default:d(()=>{var a,i;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((i=s.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(e(),_(l,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),v])}const T=r(q,[["render",P]]);export{M as __pageData,T as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as t,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const L=JSON.parse('{"title":"for循环中删除集合元素隐藏的陷阱","description":"","frontmatter":{"title":"for循环中删除集合元素隐藏的陷阱","author":"查尔斯","date":"2021/12/08 20:00","categories":["Bug万象集"],"tags":["Java集合"]},"headers":[],"relativePath":"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md","filePath":"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md","lastUpdated":1660404656000}'),B={name:"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md"},F=h("h1",{id:"for循环中删除集合元素隐藏的陷阱",tabindex:"-1"},[g("for循环中删除集合元素隐藏的陷阱 "),h("a",{class:"header-anchor",href:"#for循环中删除集合元素隐藏的陷阱","aria-label":'Permalink to "for循环中删除集合元素隐藏的陷阱"'},"")],-1),c=D(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 今天在审查代码时,发现某位同事提交的代码中有一个比较基础性的错误。</p><p>这部分需求的主要目的是将集合中指定的元素删除掉,而这位同事采用的方法是用 for 循环来循环集合索引,然后通过索引从集合中取出每一个元素,判断是否是要删除的元素,如果是就直接删除掉。</p><p><strong>大概意思的代码,如下:</strong></p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 创建集合,并初始化数据</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as t,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const L=JSON.parse('{"title":"for循环中删除集合元素隐藏的陷阱","description":"","frontmatter":{"title":"for循环中删除集合元素隐藏的陷阱","author":"查尔斯","date":"2021/12/08 20:00","categories":["Bug万象集"],"tags":["Java集合"]},"headers":[],"relativePath":"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md","filePath":"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md","lastUpdated":1660404656000}'),B={name:"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md"},F=h("h1",{id:"for循环中删除集合元素隐藏的陷阱",tabindex:"-1"},[g("for循环中删除集合元素隐藏的陷阱 "),h("a",{class:"header-anchor",href:"#for循环中删除集合元素隐藏的陷阱","aria-label":'Permalink to "for循环中删除集合元素隐藏的陷阱"'},"")],-1),c=D(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 今天在审查代码时,发现某位同事提交的代码中有一个比较基础性的错误。</p><p>这部分需求的主要目的是将集合中指定的元素删除掉,而这位同事采用的方法是用 for 循环来循环集合索引,然后通过索引从集合中取出每一个元素,判断是否是要删除的元素,如果是就直接删除掉。</p><p><strong>大概意思的代码,如下:</strong></p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 创建集合,并初始化数据</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">List</span><span style="--shiki-light:#24292E;--shiki-dark:#F69D50;"><</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">Integer</span><span style="--shiki-light:#24292E;--shiki-dark:#F69D50;">> </span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">list</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> new</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> ArrayList<>(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">4</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">list.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">add</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">list.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">add</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as t,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const L=JSON.parse('{"title":"for循环中删除集合元素隐藏的陷阱","description":"","frontmatter":{"title":"for循环中删除集合元素隐藏的陷阱","author":"查尔斯","date":"2021/12/08 20:00","categories":["Bug万象集"],"tags":["Java集合"]},"headers":[],"relativePath":"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md","filePath":"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md","lastUpdated":1660404656000}'),B={name:"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md"},F=h("h1",{id:"for循环中删除集合元素隐藏的陷阱",tabindex:"-1"},[g("for循环中删除集合元素隐藏的陷阱 "),h("a",{class:"header-anchor",href:"#for循环中删除集合元素隐藏的陷阱","aria-label":'Permalink to "for循环中删除集合元素隐藏的陷阱"'},"")],-1),c=D("",37);function E(s,o,u,m,v,f){const l=p,k=e("ClientOnly");return n(),r("div",null,[F,d(k,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(l,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),c])}const I=t(B,[["render",E]]);export{L as __pageData,I as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as t,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const L=JSON.parse('{"title":"for循环中删除集合元素隐藏的陷阱","description":"","frontmatter":{"title":"for循环中删除集合元素隐藏的陷阱","author":"查尔斯","date":"2021/12/08 20:00","categories":["Bug万象集"],"tags":["Java集合"]},"headers":[],"relativePath":"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md","filePath":"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md","lastUpdated":1660404656000}'),B={name:"categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱.md"},F=h("h1",{id:"for循环中删除集合元素隐藏的陷阱",tabindex:"-1"},[g("for循环中删除集合元素隐藏的陷阱 "),h("a",{class:"header-anchor",href:"#for循环中删除集合元素隐藏的陷阱","aria-label":'Permalink to "for循环中删除集合元素隐藏的陷阱"'},"")],-1),c=D("",37);function E(s,o,u,m,v,f){const l=p,k=e("ClientOnly");return n(),r("div",null,[F,d(k,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(l,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),c])}const I=t(B,[["render",E]]);export{L as __pageData,I as default};
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as s}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as p,o as i,c as d,I as c,w as m,k as e,a as h,R as u,b as g,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const _="/assets/202112102211700.VDo0RLtH.jpg",k="/assets/202112102211705._JlroY3Z.png",C="/assets/202112102211710.ndnGHI2f.png",q=JSON.parse('{"title":"Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration?","description":"","frontmatter":{"title":"Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration?","author":"查尔斯","date":"2021/12/10 22:11","categories":["Bug万象集"],"tags":["IDE","IntelliJ IDEA"]},"headers":[],"relativePath":"categories/issues/2021/12/10/Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md","filePath":"categories/issues/2021/12/10/Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md","lastUpdated":1665050985000}'),X={name:"categories/issues/2021/12/10/Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md"},x=e("h1",{id:"command-line-is-too-long-shorten-command-line-for-xxx-or-also-for-spring-boot-default-configuration",tabindex:"-1"},[h("Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration? "),e("a",{class:"header-anchor",href:"#command-line-is-too-long-shorten-command-line-for-xxx-or-also-for-spring-boot-default-configuration","aria-label":'Permalink to "Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration?"'},"")],-1),S=u("",18);function B(o,D,b,A,y,F){const n=s,l=p("ClientOnly");return i(),d("div",null,[x,c(l,null,{default:m(()=>{var a,t;return[(((a=o.$frontmatter)==null?void 0:a.aside)??!0)&&(((t=o.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(i(),g(n,{key:0,article:o.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),S])}const P=r(X,[["render",B]]);export{q as __pageData,P as default};
|
||||
import{_ as s}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as p,o as i,c as d,I as c,w as m,k as e,a as h,R as u,b as g,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const _="/assets/202112102211700.VDo0RLtH.jpg",k="/assets/202112102211705._JlroY3Z.png",C="/assets/202112102211710.ndnGHI2f.png",q=JSON.parse('{"title":"Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration?","description":"","frontmatter":{"title":"Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration?","author":"查尔斯","date":"2021/12/10 22:11","categories":["Bug万象集"],"tags":["IDE","IntelliJ IDEA"]},"headers":[],"relativePath":"categories/issues/2021/12/10/Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md","filePath":"categories/issues/2021/12/10/Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md","lastUpdated":1665050985000}'),X={name:"categories/issues/2021/12/10/Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md"},x=e("h1",{id:"command-line-is-too-long-shorten-command-line-for-xxx-or-also-for-spring-boot-default-configuration",tabindex:"-1"},[h("Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration? "),e("a",{class:"header-anchor",href:"#command-line-is-too-long-shorten-command-line-for-xxx-or-also-for-spring-boot-default-configuration","aria-label":'Permalink to "Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration?"'},"")],-1),S=u("",18);function B(o,D,b,A,y,F){const n=s,l=p("ClientOnly");return i(),d("div",null,[x,c(l,null,{default:m(()=>{var a,t;return[(((a=o.$frontmatter)==null?void 0:a.aside)??!0)&&(((t=o.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(i(),g(n,{key:0,article:o.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),S])}const P=r(X,[["render",B]]);export{q as __pageData,P as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as t,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const Q=JSON.parse('{"title":"SQL 注入攻击风险","description":"","frontmatter":{"title":"SQL 注入攻击风险","author":"查尔斯","date":"2021/12/11 22:51","categories":["Bug万象集"],"tags":["SQL","网络攻击"]},"headers":[],"relativePath":"categories/issues/2021/12/11/SQL 注入攻击风险.md","filePath":"categories/issues/2021/12/11/SQL 注入攻击风险.md","lastUpdated":1660404656000}'),F={name:"categories/issues/2021/12/11/SQL 注入攻击风险.md"},B=h("h1",{id:"sql-注入攻击风险",tabindex:"-1"},[g("SQL 注入攻击风险 "),h("a",{class:"header-anchor",href:"#sql-注入攻击风险","aria-label":'Permalink to "SQL 注入攻击风险"'},"")],-1),c=D(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> Java 开发者都知道,想要用 Java 连接关系型数据库进行操作,就要学习使用 java.sql 包下的一套 JDBC API,这套 API 的使用步骤,大致如下:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as t,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const Q=JSON.parse('{"title":"SQL 注入攻击风险","description":"","frontmatter":{"title":"SQL 注入攻击风险","author":"查尔斯","date":"2021/12/11 22:51","categories":["Bug万象集"],"tags":["SQL","网络攻击"]},"headers":[],"relativePath":"categories/issues/2021/12/11/SQL 注入攻击风险.md","filePath":"categories/issues/2021/12/11/SQL 注入攻击风险.md","lastUpdated":1660404656000}'),F={name:"categories/issues/2021/12/11/SQL 注入攻击风险.md"},B=h("h1",{id:"sql-注入攻击风险",tabindex:"-1"},[g("SQL 注入攻击风险 "),h("a",{class:"header-anchor",href:"#sql-注入攻击风险","aria-label":'Permalink to "SQL 注入攻击风险"'},"")],-1),c=D(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> Java 开发者都知道,想要用 Java 连接关系型数据库进行操作,就要学习使用 java.sql 包下的一套 JDBC API,这套 API 的使用步骤,大致如下:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * JDBC,模拟登录示例</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> *</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">@author</span><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> Charles7c</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as t,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const Q=JSON.parse('{"title":"SQL 注入攻击风险","description":"","frontmatter":{"title":"SQL 注入攻击风险","author":"查尔斯","date":"2021/12/11 22:51","categories":["Bug万象集"],"tags":["SQL","网络攻击"]},"headers":[],"relativePath":"categories/issues/2021/12/11/SQL 注入攻击风险.md","filePath":"categories/issues/2021/12/11/SQL 注入攻击风险.md","lastUpdated":1660404656000}'),F={name:"categories/issues/2021/12/11/SQL 注入攻击风险.md"},B=h("h1",{id:"sql-注入攻击风险",tabindex:"-1"},[g("SQL 注入攻击风险 "),h("a",{class:"header-anchor",href:"#sql-注入攻击风险","aria-label":'Permalink to "SQL 注入攻击风险"'},"")],-1),c=D("",37);function o(s,E,u,m,S,q){const k=p,l=e("ClientOnly");return n(),r("div",null,[B,d(l,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(k,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),c])}const _=t(F,[["render",o]]);export{Q as __pageData,_ as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as t,D as e,o as n,c as r,I as d,w as A,k as h,a as g,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const Q=JSON.parse('{"title":"SQL 注入攻击风险","description":"","frontmatter":{"title":"SQL 注入攻击风险","author":"查尔斯","date":"2021/12/11 22:51","categories":["Bug万象集"],"tags":["SQL","网络攻击"]},"headers":[],"relativePath":"categories/issues/2021/12/11/SQL 注入攻击风险.md","filePath":"categories/issues/2021/12/11/SQL 注入攻击风险.md","lastUpdated":1660404656000}'),F={name:"categories/issues/2021/12/11/SQL 注入攻击风险.md"},B=h("h1",{id:"sql-注入攻击风险",tabindex:"-1"},[g("SQL 注入攻击风险 "),h("a",{class:"header-anchor",href:"#sql-注入攻击风险","aria-label":'Permalink to "SQL 注入攻击风险"'},"")],-1),c=D("",37);function o(s,E,u,m,S,q){const k=p,l=e("ClientOnly");return n(),r("div",null,[B,d(l,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(k,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),c])}const _=t(F,[["render",o]]);export{Q as __pageData,_ as default};
|
@@ -1,2 +1,2 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as c,o as e,c as l,I as _,w as d,k as i,a as h,R as m,b as g,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const k="/assets/202112132257200.L1G0bgyr.png",f="/assets/202112132257205.p2i2ER30.png",F="/assets/202112132257210.3wmuV8_R.png",b="/assets/202112132257215.wz0_uS5L.png",v="/assets/202112132257220.6vPFeL9c.png",y="/assets/202112132257225.YIvw6ypF.png",C="/assets/202112132257230.Hsr2v59n.png",D="/assets/202112132257235.YLpxcDjZ.png",L=JSON.parse('{"title":"无法访问 F:\\\\。文件或目录损坏且无法读取。","description":"","frontmatter":{"title":"无法访问 F:\\\\。文件或目录损坏且无法读取。","author":"查尔斯","date":"2021/12/13 22:57","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md","filePath":"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md","lastUpdated":1663747241000}'),P={name:"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md"},x=i("h1",{id:"无法访问-f-。文件或目录损坏且无法读取。",tabindex:"-1"},[h("无法访问 F:\\。文件或目录损坏且无法读取。 "),i("a",{class:"header-anchor",href:"#无法访问-f-。文件或目录损坏且无法读取。","aria-label":'Permalink to "无法访问 F:\\。文件或目录损坏且无法读取。"'},"")],-1),q=m('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p>笔者这块西数的移动硬盘最近真的是问题频发,前段时间无法删除损坏的回收站,这两天在家里电脑上插上之后,双击 F 盘提示已损坏,较之以前问题更甚。</p><p>这的确给了笔者一个 “惊喜”,最近两周好像没开 Drive 备份到 NAS 。硬盘要是坏了,这两周的东西还能剩下多少就不好说了。</p><p>不过好在最后问题解决了,跟笔者来一起看看解决方法吧。</p><p><img src="'+k+'" alt="202112132257200"></p><h2 id="解决方案" tabindex="-1">解决方案 <a class="header-anchor" href="#解决方案" aria-label="Permalink to "解决方案""></a></h2><h3 id="尝试1-尝试检查与修复" tabindex="-1">尝试1:尝试检查与修复 <a class="header-anchor" href="#尝试1-尝试检查与修复" aria-label="Permalink to "尝试1:尝试检查与修复""></a></h3><p>首先,在出现问题的磁盘上【右键】单击,然后选择【属性】。</p><p><img src="'+f+'" alt="202112132257205"></p><p>在弹出的【属性】对话框中,选择【工具】选项卡,然后点击【检查】按钮。这个功能是用来检查磁盘文件系统错误的,检查完还会有个错误修复的环节。</p><p><img src="'+F+'" alt="202112132257210"></p><p>可惜的是,不知道是笔者这台电脑登录的账号权限问题,还是系统错误,这项修复手段,笔者用不了。</p><p><img src="'+b+'" alt="202112132257215"></p><h3 id="尝试2-命令行修复" tabindex="-1">尝试2:命令行修复 <a class="header-anchor" href="#尝试2-命令行修复" aria-label="Permalink to "尝试2:命令行修复""></a></h3><p>还是老规矩,桌面可视化中的功能只是一种手段,每一项功能都有其对应的系统命令。</p><p>按下【Windows】键,弹出【开始】菜单,直接输入【cmd】来在菜单中搜索。搜索出来后,在【cmd.exe/命令行】上【右键】单击,选择【以管理员身份运行】。</p><p><img src="'+v+`" alt="202112132257220"></p><p>在弹出的 CMD 命令行窗口中,输入以下命令:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 这条命令是用来检查磁盘并修复的,中间的 f: 换成你出现上方问题的盘符即可。 </span></span>
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as c,o as e,c as l,I as _,w as d,k as i,a as h,R as m,b as g,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const k="/assets/202112132257200.L1G0bgyr.png",f="/assets/202112132257205.p2i2ER30.png",F="/assets/202112132257210.3wmuV8_R.png",b="/assets/202112132257215.wz0_uS5L.png",v="/assets/202112132257220.6vPFeL9c.png",y="/assets/202112132257225.YIvw6ypF.png",C="/assets/202112132257230.Hsr2v59n.png",D="/assets/202112132257235.YLpxcDjZ.png",L=JSON.parse('{"title":"无法访问 F:\\\\。文件或目录损坏且无法读取。","description":"","frontmatter":{"title":"无法访问 F:\\\\。文件或目录损坏且无法读取。","author":"查尔斯","date":"2021/12/13 22:57","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md","filePath":"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md","lastUpdated":1663747241000}'),P={name:"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md"},x=i("h1",{id:"无法访问-f-。文件或目录损坏且无法读取。",tabindex:"-1"},[h("无法访问 F:\\。文件或目录损坏且无法读取。 "),i("a",{class:"header-anchor",href:"#无法访问-f-。文件或目录损坏且无法读取。","aria-label":'Permalink to "无法访问 F:\\。文件或目录损坏且无法读取。"'},"")],-1),q=m('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p>笔者这块西数的移动硬盘最近真的是问题频发,前段时间无法删除损坏的回收站,这两天在家里电脑上插上之后,双击 F 盘提示已损坏,较之以前问题更甚。</p><p>这的确给了笔者一个 “惊喜”,最近两周好像没开 Drive 备份到 NAS 。硬盘要是坏了,这两周的东西还能剩下多少就不好说了。</p><p>不过好在最后问题解决了,跟笔者来一起看看解决方法吧。</p><p><img src="'+k+'" alt="202112132257200"></p><h2 id="解决方案" tabindex="-1">解决方案 <a class="header-anchor" href="#解决方案" aria-label="Permalink to "解决方案""></a></h2><h3 id="尝试1-尝试检查与修复" tabindex="-1">尝试1:尝试检查与修复 <a class="header-anchor" href="#尝试1-尝试检查与修复" aria-label="Permalink to "尝试1:尝试检查与修复""></a></h3><p>首先,在出现问题的磁盘上【右键】单击,然后选择【属性】。</p><p><img src="'+f+'" alt="202112132257205"></p><p>在弹出的【属性】对话框中,选择【工具】选项卡,然后点击【检查】按钮。这个功能是用来检查磁盘文件系统错误的,检查完还会有个错误修复的环节。</p><p><img src="'+F+'" alt="202112132257210"></p><p>可惜的是,不知道是笔者这台电脑登录的账号权限问题,还是系统错误,这项修复手段,笔者用不了。</p><p><img src="'+b+'" alt="202112132257215"></p><h3 id="尝试2-命令行修复" tabindex="-1">尝试2:命令行修复 <a class="header-anchor" href="#尝试2-命令行修复" aria-label="Permalink to "尝试2:命令行修复""></a></h3><p>还是老规矩,桌面可视化中的功能只是一种手段,每一项功能都有其对应的系统命令。</p><p>按下【Windows】键,弹出【开始】菜单,直接输入【cmd】来在菜单中搜索。搜索出来后,在【cmd.exe/命令行】上【右键】单击,选择【以管理员身份运行】。</p><p><img src="'+v+`" alt="202112132257220"></p><p>在弹出的 CMD 命令行窗口中,输入以下命令:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 这条命令是用来检查磁盘并修复的,中间的 f: 换成你出现上方问题的盘符即可。 </span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">chkdsk</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> f:</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /f</span></span></code></pre></div><p><img src="`+y+'" alt="202112132257225"></p><p><img src="'+C+'" alt="202112132257230"></p><p>等待检查修复结束,笔者的 F 盘又回来了。</p><p><img src="'+D+'" alt="202112132257235"></p>',23);function w(a,N,V,A,S,T){const r=o,n=c("ClientOnly");return e(),l("div",null,[x,_(n,null,{default:d(()=>{var s,t;return[(((s=a.$frontmatter)==null?void 0:s.aside)??!0)&&(((t=a.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(e(),g(r,{key:0,article:a.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),q])}const R=p(P,[["render",w]]);export{L as __pageData,R as default};
|
@@ -1 +1 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as c,o as e,c as l,I as _,w as d,k as i,a as h,R as m,b as g,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const k="/assets/202112132257200.L1G0bgyr.png",f="/assets/202112132257205.p2i2ER30.png",F="/assets/202112132257210.3wmuV8_R.png",b="/assets/202112132257215.wz0_uS5L.png",v="/assets/202112132257220.6vPFeL9c.png",y="/assets/202112132257225.YIvw6ypF.png",C="/assets/202112132257230.Hsr2v59n.png",D="/assets/202112132257235.YLpxcDjZ.png",L=JSON.parse('{"title":"无法访问 F:\\\\。文件或目录损坏且无法读取。","description":"","frontmatter":{"title":"无法访问 F:\\\\。文件或目录损坏且无法读取。","author":"查尔斯","date":"2021/12/13 22:57","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md","filePath":"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md","lastUpdated":1663747241000}'),P={name:"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md"},x=i("h1",{id:"无法访问-f-。文件或目录损坏且无法读取。",tabindex:"-1"},[h("无法访问 F:\\。文件或目录损坏且无法读取。 "),i("a",{class:"header-anchor",href:"#无法访问-f-。文件或目录损坏且无法读取。","aria-label":'Permalink to "无法访问 F:\\。文件或目录损坏且无法读取。"'},"")],-1),q=m("",23);function w(a,N,V,A,S,T){const r=o,n=c("ClientOnly");return e(),l("div",null,[x,_(n,null,{default:d(()=>{var s,t;return[(((s=a.$frontmatter)==null?void 0:s.aside)??!0)&&(((t=a.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(e(),g(r,{key:0,article:a.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),q])}const R=p(P,[["render",w]]);export{L as __pageData,R as default};
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as c,o as e,c as l,I as _,w as d,k as i,a as h,R as m,b as g,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const k="/assets/202112132257200.L1G0bgyr.png",f="/assets/202112132257205.p2i2ER30.png",F="/assets/202112132257210.3wmuV8_R.png",b="/assets/202112132257215.wz0_uS5L.png",v="/assets/202112132257220.6vPFeL9c.png",y="/assets/202112132257225.YIvw6ypF.png",C="/assets/202112132257230.Hsr2v59n.png",D="/assets/202112132257235.YLpxcDjZ.png",L=JSON.parse('{"title":"无法访问 F:\\\\。文件或目录损坏且无法读取。","description":"","frontmatter":{"title":"无法访问 F:\\\\。文件或目录损坏且无法读取。","author":"查尔斯","date":"2021/12/13 22:57","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md","filePath":"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md","lastUpdated":1663747241000}'),P={name:"categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取.md"},x=i("h1",{id:"无法访问-f-。文件或目录损坏且无法读取。",tabindex:"-1"},[h("无法访问 F:\\。文件或目录损坏且无法读取。 "),i("a",{class:"header-anchor",href:"#无法访问-f-。文件或目录损坏且无法读取。","aria-label":'Permalink to "无法访问 F:\\。文件或目录损坏且无法读取。"'},"")],-1),q=m("",23);function w(a,N,V,A,S,T){const r=o,n=c("ClientOnly");return e(),l("div",null,[x,_(n,null,{default:d(()=>{var s,t;return[(((s=a.$frontmatter)==null?void 0:s.aside)??!0)&&(((t=a.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(e(),g(r,{key:0,article:a.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),q])}const R=p(P,[["render",w]]);export{L as __pageData,R as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as C,I as r,w as d,k as t,a as g,R as o,b as A,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202201260941889.GJRZvJA-.png",u="/assets/202201260942561.LffePadq.png",f=JSON.parse('{"title":"JavaScript 无法存储 Java Long 类型数据问题","description":"","frontmatter":{"title":"JavaScript 无法存储 Java Long 类型数据问题","author":"查尔斯","date":"2022/01/26 09:07","categories":["Bug万象集"],"tags":["JavaScript"]},"headers":[],"relativePath":"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md","filePath":"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md","lastUpdated":1660404656000}'),B={name:"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md"},c=t("h1",{id:"javascript-无法存储-java-long-类型数据问题",tabindex:"-1"},[g("JavaScript 无法存储 Java Long 类型数据问题 "),t("a",{class:"header-anchor",href:"#javascript-无法存储-java-long-类型数据问题","aria-label":'Permalink to "JavaScript 无法存储 Java Long 类型数据问题"'},"")],-1),q=o(`<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p>今天在解决一个需求问题的时候,遇到了一个难得一见的 JS 问题。这个问题大概是和一些同学在开发环境使用 == 来比较包装类型的整数一样,由于比较的数值在缓存范围内,因缘际会的错过了 bug 的出现。</p><p>简单说一下问题经过,是这样的,笔者这个需求最终要求接口返回一组自定义结构的 k-v (不是单纯的键值对)数据,用于在前端表单中进行分类展示。</p><p>后端响应的数据结构类似如下:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">{</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as C,I as r,w as d,k as t,a as g,R as o,b as A,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202201260941889.GJRZvJA-.png",u="/assets/202201260942561.LffePadq.png",f=JSON.parse('{"title":"JavaScript 无法存储 Java Long 类型数据问题","description":"","frontmatter":{"title":"JavaScript 无法存储 Java Long 类型数据问题","author":"查尔斯","date":"2022/01/26 09:07","categories":["Bug万象集"],"tags":["JavaScript"]},"headers":[],"relativePath":"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md","filePath":"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md","lastUpdated":1660404656000}'),B={name:"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md"},c=t("h1",{id:"javascript-无法存储-java-long-类型数据问题",tabindex:"-1"},[g("JavaScript 无法存储 Java Long 类型数据问题 "),t("a",{class:"header-anchor",href:"#javascript-无法存储-java-long-类型数据问题","aria-label":'Permalink to "JavaScript 无法存储 Java Long 类型数据问题"'},"")],-1),q=o(`<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p>今天在解决一个需求问题的时候,遇到了一个难得一见的 JS 问题。这个问题大概是和一些同学在开发环境使用 == 来比较包装类型的整数一样,由于比较的数值在缓存范围内,因缘际会的错过了 bug 的出现。</p><p>简单说一下问题经过,是这样的,笔者这个需求最终要求接口返回一组自定义结构的 k-v (不是单纯的键值对)数据,用于在前端表单中进行分类展示。</p><p>后端响应的数据结构类似如下:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#8DDB8C;"> "code"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">200</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">, </span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#8DDB8C;"> "errorMsg"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">""</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">, </span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#8DDB8C;"> "result"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">: [</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as C,I as r,w as d,k as t,a as g,R as o,b as A,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202201260941889.GJRZvJA-.png",u="/assets/202201260942561.LffePadq.png",f=JSON.parse('{"title":"JavaScript 无法存储 Java Long 类型数据问题","description":"","frontmatter":{"title":"JavaScript 无法存储 Java Long 类型数据问题","author":"查尔斯","date":"2022/01/26 09:07","categories":["Bug万象集"],"tags":["JavaScript"]},"headers":[],"relativePath":"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md","filePath":"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md","lastUpdated":1660404656000}'),B={name:"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md"},c=t("h1",{id:"javascript-无法存储-java-long-类型数据问题",tabindex:"-1"},[g("JavaScript 无法存储 Java Long 类型数据问题 "),t("a",{class:"header-anchor",href:"#javascript-无法存储-java-long-类型数据问题","aria-label":'Permalink to "JavaScript 无法存储 Java Long 类型数据问题"'},"")],-1),q=o("",18);function E(s,F,v,_,m,S){const h=p,l=e("ClientOnly");return n(),C("div",null,[c,r(l,null,{default:d(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),A(h,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),q])}const L=k(B,[["render",E]]);export{f as __pageData,L as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as C,I as r,w as d,k as t,a as g,R as o,b as A,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202201260941889.GJRZvJA-.png",u="/assets/202201260942561.LffePadq.png",f=JSON.parse('{"title":"JavaScript 无法存储 Java Long 类型数据问题","description":"","frontmatter":{"title":"JavaScript 无法存储 Java Long 类型数据问题","author":"查尔斯","date":"2022/01/26 09:07","categories":["Bug万象集"],"tags":["JavaScript"]},"headers":[],"relativePath":"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md","filePath":"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md","lastUpdated":1660404656000}'),B={name:"categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题.md"},c=t("h1",{id:"javascript-无法存储-java-long-类型数据问题",tabindex:"-1"},[g("JavaScript 无法存储 Java Long 类型数据问题 "),t("a",{class:"header-anchor",href:"#javascript-无法存储-java-long-类型数据问题","aria-label":'Permalink to "JavaScript 无法存储 Java Long 类型数据问题"'},"")],-1),q=o("",18);function E(s,F,v,_,m,S){const h=p,l=e("ClientOnly");return n(),C("div",null,[c,r(l,null,{default:d(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),A(h,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),q])}const L=k(B,[["render",E]]);export{f as __pageData,L as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as g,I as d,w as r,k as l,a as A,R as c,b as y,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"创建一个自身类的静态对象变量,究竟会如何执行?","description":"","frontmatter":{"title":"创建一个自身类的静态对象变量,究竟会如何执行?","author":"查尔斯","date":"2022/03/24 21:30","categories":["Bug万象集"],"tags":["Java","JVM"]},"headers":[],"relativePath":"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md","filePath":"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md","lastUpdated":1660404656000}'),o={name:"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md"},C=l("h1",{id:"创建一个自身类的静态对象变量-究竟会如何执行",tabindex:"-1"},[A("创建一个自身类的静态对象变量,究竟会如何执行? "),l("a",{class:"header-anchor",href:"#创建一个自身类的静态对象变量-究竟会如何执行","aria-label":'Permalink to "创建一个自身类的静态对象变量,究竟会如何执行?"'},"")],-1),F=c(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 近两周在疯狂给项目组面试招聘,昨天晚上10点多,产品总监在面试群里发了一道题,问运行结果是什么,题目如下:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> Singleton</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as g,I as d,w as r,k as l,a as A,R as c,b as y,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"创建一个自身类的静态对象变量,究竟会如何执行?","description":"","frontmatter":{"title":"创建一个自身类的静态对象变量,究竟会如何执行?","author":"查尔斯","date":"2022/03/24 21:30","categories":["Bug万象集"],"tags":["Java","JVM"]},"headers":[],"relativePath":"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md","filePath":"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md","lastUpdated":1660404656000}'),o={name:"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md"},C=l("h1",{id:"创建一个自身类的静态对象变量-究竟会如何执行",tabindex:"-1"},[A("创建一个自身类的静态对象变量,究竟会如何执行? "),l("a",{class:"header-anchor",href:"#创建一个自身类的静态对象变量-究竟会如何执行","aria-label":'Permalink to "创建一个自身类的静态对象变量,究竟会如何执行?"'},"")],-1),F=c(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 近两周在疯狂给项目组面试招聘,昨天晚上10点多,产品总监在面试群里发了一道题,问运行结果是什么,题目如下:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;"> Singleton</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> {</span></span>
|
||||
<span class="line highlighted"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> private</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> static</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> Singleton</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> singleton</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;"> Singleton</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">();</span></span>
|
||||
<span class="line highlighted"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> public</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> static</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> count1;</span></span>
|
||||
<span class="line highlighted"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> public</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> static</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> count2</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> =</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 3</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as g,I as d,w as r,k as l,a as A,R as c,b as y,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"创建一个自身类的静态对象变量,究竟会如何执行?","description":"","frontmatter":{"title":"创建一个自身类的静态对象变量,究竟会如何执行?","author":"查尔斯","date":"2022/03/24 21:30","categories":["Bug万象集"],"tags":["Java","JVM"]},"headers":[],"relativePath":"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md","filePath":"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md","lastUpdated":1660404656000}'),o={name:"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md"},C=l("h1",{id:"创建一个自身类的静态对象变量-究竟会如何执行",tabindex:"-1"},[A("创建一个自身类的静态对象变量,究竟会如何执行? "),l("a",{class:"header-anchor",href:"#创建一个自身类的静态对象变量-究竟会如何执行","aria-label":'Permalink to "创建一个自身类的静态对象变量,究竟会如何执行?"'},"")],-1),F=c("",27);function B(s,u,E,m,v,_){const t=p,h=e("ClientOnly");return n(),g("div",null,[C,d(h,null,{default:r(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(t,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),F])}const T=k(o,[["render",B]]);export{f as __pageData,T as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as g,I as d,w as r,k as l,a as A,R as c,b as y,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"创建一个自身类的静态对象变量,究竟会如何执行?","description":"","frontmatter":{"title":"创建一个自身类的静态对象变量,究竟会如何执行?","author":"查尔斯","date":"2022/03/24 21:30","categories":["Bug万象集"],"tags":["Java","JVM"]},"headers":[],"relativePath":"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md","filePath":"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md","lastUpdated":1660404656000}'),o={name:"categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?.md"},C=l("h1",{id:"创建一个自身类的静态对象变量-究竟会如何执行",tabindex:"-1"},[A("创建一个自身类的静态对象变量,究竟会如何执行? "),l("a",{class:"header-anchor",href:"#创建一个自身类的静态对象变量-究竟会如何执行","aria-label":'Permalink to "创建一个自身类的静态对象变量,究竟会如何执行?"'},"")],-1),F=c("",27);function B(s,u,E,m,v,_){const t=p,h=e("ClientOnly");return n(),g("div",null,[C,d(h,null,{default:r(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(t,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),F])}const T=k(o,[["render",B]]);export{f as __pageData,T as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as h}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as k,o as n,c as d,I as r,w as o,k as t,a as c,R as F,b as g,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const A="/assets/202208112010100.rCMreawF.png",J=JSON.parse('{"title":"执行Shell脚本,报java: command not found","description":"","frontmatter":{"title":"执行Shell脚本,报java: command not found","author":"查尔斯","date":"2022/08/11 20:19","categories":["Bug万象集"],"tags":["Linux","Shell"]},"headers":[],"relativePath":"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md","filePath":"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md","lastUpdated":1667230305000}'),D={name:"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md"},m=t("h1",{id:"执行shell脚本-报java-command-not-found",tabindex:"-1"},[c("执行Shell脚本,报java: command not found "),t("a",{class:"header-anchor",href:"#执行shell脚本-报java-command-not-found","aria-label":'Permalink to "执行Shell脚本,报java: command not found"'},"")],-1),u=F('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天笔者在公司的 dev 环境服务器上,将一个 Java 程序启动脚本做成了一个系统服务。本来是一件很简单的事情,但是在启动服务时,却报错了。</p><p>报的错误也是言简意赅:java: command not found。很直白的告诉了你,它找不到 java 命令。</p><p><img src="'+A+`" alt="202208112010100"></p><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>既然是找不到 java 命令,首先要排查的自然是服务器里究竟有没有安装和配置好 Java 环境了,用 <code>java -version</code> 命令检测一下就可以了。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">[root@business11 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">~</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">]# java -version</span></span>
|
||||
import{_ as h}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as k,o as n,c as d,I as r,w as o,k as t,a as c,R as F,b as g,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const A="/assets/202208112010100.rCMreawF.png",J=JSON.parse('{"title":"执行Shell脚本,报java: command not found","description":"","frontmatter":{"title":"执行Shell脚本,报java: command not found","author":"查尔斯","date":"2022/08/11 20:19","categories":["Bug万象集"],"tags":["Linux","Shell"]},"headers":[],"relativePath":"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md","filePath":"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md","lastUpdated":1667230305000}'),D={name:"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md"},m=t("h1",{id:"执行shell脚本-报java-command-not-found",tabindex:"-1"},[c("执行Shell脚本,报java: command not found "),t("a",{class:"header-anchor",href:"#执行shell脚本-报java-command-not-found","aria-label":'Permalink to "执行Shell脚本,报java: command not found"'},"")],-1),u=F('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天笔者在公司的 dev 环境服务器上,将一个 Java 程序启动脚本做成了一个系统服务。本来是一件很简单的事情,但是在启动服务时,却报错了。</p><p>报的错误也是言简意赅:java: command not found。很直白的告诉了你,它找不到 java 命令。</p><p><img src="'+A+`" alt="202208112010100"></p><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>既然是找不到 java 命令,首先要排查的自然是服务器里究竟有没有安装和配置好 Java 环境了,用 <code>java -version</code> 命令检测一下就可以了。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">[root@business11 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">~</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">]# java -version</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">java</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> version</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> "1.8.0_202"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">Java(TM</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">) SE Runtime Environment (</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">build</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 1.8</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">.0_202-b08</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">Java</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> HotSpot</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">TM</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">) </span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">64</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">-Bit</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> Server</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> VM</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> (build </span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">25.202</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">-b08,</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> mixed</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> mode</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">)</span></span></code></pre></div><p>Java 环境是配置好的,那还得是看脚本自身的问题了。其实,这个问题以前印象里也出现过,不过是很久以前初次使用 Shell 脚本的时候了,最终的问题点是因为直接写的脚本内容,没有添加 <code>#!/bin/bash</code> 声明导致的。</p><p>打开脚本内容看了看,这个声明也加着呢。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">#!/bin/bash</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as h}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as k,o as n,c as d,I as r,w as o,k as t,a as c,R as F,b as g,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const A="/assets/202208112010100.rCMreawF.png",J=JSON.parse('{"title":"执行Shell脚本,报java: command not found","description":"","frontmatter":{"title":"执行Shell脚本,报java: command not found","author":"查尔斯","date":"2022/08/11 20:19","categories":["Bug万象集"],"tags":["Linux","Shell"]},"headers":[],"relativePath":"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md","filePath":"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md","lastUpdated":1667230305000}'),D={name:"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md"},m=t("h1",{id:"执行shell脚本-报java-command-not-found",tabindex:"-1"},[c("执行Shell脚本,报java: command not found "),t("a",{class:"header-anchor",href:"#执行shell脚本-报java-command-not-found","aria-label":'Permalink to "执行Shell脚本,报java: command not found"'},"")],-1),u=F("",20);function C(s,v,_,b,E,B){const l=h,e=k("ClientOnly");return n(),d("div",null,[m,r(e,null,{default:o(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),g(l,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),u])}const x=p(D,[["render",C]]);export{J as __pageData,x as default};
|
||||
import{_ as h}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as k,o as n,c as d,I as r,w as o,k as t,a as c,R as F,b as g,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const A="/assets/202208112010100.rCMreawF.png",J=JSON.parse('{"title":"执行Shell脚本,报java: command not found","description":"","frontmatter":{"title":"执行Shell脚本,报java: command not found","author":"查尔斯","date":"2022/08/11 20:19","categories":["Bug万象集"],"tags":["Linux","Shell"]},"headers":[],"relativePath":"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md","filePath":"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md","lastUpdated":1667230305000}'),D={name:"categories/issues/2022/08/11/执行Shell脚本,报java command not found.md"},m=t("h1",{id:"执行shell脚本-报java-command-not-found",tabindex:"-1"},[c("执行Shell脚本,报java: command not found "),t("a",{class:"header-anchor",href:"#执行shell脚本-报java-command-not-found","aria-label":'Permalink to "执行Shell脚本,报java: command not found"'},"")],-1),u=F("",20);function C(s,v,_,b,E,B){const l=h,e=k("ClientOnly");return n(),d("div",null,[m,r(e,null,{default:o(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),g(l,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),u])}const x=p(D,[["render",C]]);export{J as __pageData,x as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as o,o as n,c as h,I as k,w as g,k as t,a as c,R as d,b as A,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const C="/assets/202208312238666.524n3PJu.png",j=JSON.parse('{"title":"SpringBoot项目引入OpenFeign后无法启动","description":"","frontmatter":{"title":"SpringBoot项目引入OpenFeign后无法启动","author":"查尔斯","date":"2022/08/31 22:39","categories":["Bug万象集"],"tags":["Java","Spring Boot","Spring Cloud","Open Feign"]},"headers":[],"relativePath":"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md","filePath":"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md","lastUpdated":1664190053000}'),D={name:"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md"},B=t("h1",{id:"springboot项目引入openfeign后无法启动",tabindex:"-1"},[c("SpringBoot项目引入OpenFeign后无法启动 "),t("a",{class:"header-anchor",href:"#springboot项目引入openfeign后无法启动","aria-label":'Permalink to "SpringBoot项目引入OpenFeign后无法启动"'},"")],-1),u=d(`<p><strong>C:</strong> 由于项目需要调用第三方 API,所以打算使用 Open Feign 来作为调用工具。但这次新项目用的 Spring Boot 版本有点高,花了点时间排除问题。</p><h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p>先简单描述一下我们项目的技术栈,这是一个前后端分离的单体项目,前端不用提,后端部分主框架用的是 Spring Boot 2.7.2 版本。现在需要对接第三方 API,打算使用 Open Feign 来作为调用工具。Open Feign 是 Spring Cloud 开发的一个轻量级RESTful HTTP 服务客户端,多数使用的场景是用于微服务项目。</p><h3 id="引入依赖" tabindex="-1">引入依赖 <a class="header-anchor" href="#引入依赖" aria-label="Permalink to "引入依赖""></a></h3><p>下方只贴出了关键部分依赖:</p><div class="language-xml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"><</span><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">properties</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">></span></span>
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as o,o as n,c as h,I as k,w as g,k as t,a as c,R as d,b as A,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const C="/assets/202208312238666.524n3PJu.png",j=JSON.parse('{"title":"SpringBoot项目引入OpenFeign后无法启动","description":"","frontmatter":{"title":"SpringBoot项目引入OpenFeign后无法启动","author":"查尔斯","date":"2022/08/31 22:39","categories":["Bug万象集"],"tags":["Java","Spring Boot","Spring Cloud","Open Feign"]},"headers":[],"relativePath":"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md","filePath":"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md","lastUpdated":1664190053000}'),D={name:"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md"},B=t("h1",{id:"springboot项目引入openfeign后无法启动",tabindex:"-1"},[c("SpringBoot项目引入OpenFeign后无法启动 "),t("a",{class:"header-anchor",href:"#springboot项目引入openfeign后无法启动","aria-label":'Permalink to "SpringBoot项目引入OpenFeign后无法启动"'},"")],-1),u=d(`<p><strong>C:</strong> 由于项目需要调用第三方 API,所以打算使用 Open Feign 来作为调用工具。但这次新项目用的 Spring Boot 版本有点高,花了点时间排除问题。</p><h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p>先简单描述一下我们项目的技术栈,这是一个前后端分离的单体项目,前端不用提,后端部分主框架用的是 Spring Boot 2.7.2 版本。现在需要对接第三方 API,打算使用 Open Feign 来作为调用工具。Open Feign 是 Spring Cloud 开发的一个轻量级RESTful HTTP 服务客户端,多数使用的场景是用于微服务项目。</p><h3 id="引入依赖" tabindex="-1">引入依赖 <a class="header-anchor" href="#引入依赖" aria-label="Permalink to "引入依赖""></a></h3><p>下方只贴出了关键部分依赖:</p><div class="language-xml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"><</span><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">properties</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">></span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> <</span><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">spring-cloud.version</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">>2.0.4.RELEASE</</span><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">spring-cloud.version</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">></span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"></</span><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">properties</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">></span></span>
|
||||
<span class="line"></span>
|
@@ -1 +1 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as o,o as n,c as h,I as k,w as g,k as t,a as c,R as d,b as A,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const C="/assets/202208312238666.524n3PJu.png",j=JSON.parse('{"title":"SpringBoot项目引入OpenFeign后无法启动","description":"","frontmatter":{"title":"SpringBoot项目引入OpenFeign后无法启动","author":"查尔斯","date":"2022/08/31 22:39","categories":["Bug万象集"],"tags":["Java","Spring Boot","Spring Cloud","Open Feign"]},"headers":[],"relativePath":"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md","filePath":"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md","lastUpdated":1664190053000}'),D={name:"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md"},B=t("h1",{id:"springboot项目引入openfeign后无法启动",tabindex:"-1"},[c("SpringBoot项目引入OpenFeign后无法启动 "),t("a",{class:"header-anchor",href:"#springboot项目引入openfeign后无法启动","aria-label":'Permalink to "SpringBoot项目引入OpenFeign后无法启动"'},"")],-1),u=d("",38);function f(s,b,m,E,F,v){const e=l,p=o("ClientOnly");return n(),h("div",null,[B,k(p,null,{default:g(()=>{var a,i;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((i=s.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(n(),A(e,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),u])}const L=r(D,[["render",f]]);export{j as __pageData,L as default};
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as o,o as n,c as h,I as k,w as g,k as t,a as c,R as d,b as A,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const C="/assets/202208312238666.524n3PJu.png",j=JSON.parse('{"title":"SpringBoot项目引入OpenFeign后无法启动","description":"","frontmatter":{"title":"SpringBoot项目引入OpenFeign后无法启动","author":"查尔斯","date":"2022/08/31 22:39","categories":["Bug万象集"],"tags":["Java","Spring Boot","Spring Cloud","Open Feign"]},"headers":[],"relativePath":"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md","filePath":"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md","lastUpdated":1664190053000}'),D={name:"categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动.md"},B=t("h1",{id:"springboot项目引入openfeign后无法启动",tabindex:"-1"},[c("SpringBoot项目引入OpenFeign后无法启动 "),t("a",{class:"header-anchor",href:"#springboot项目引入openfeign后无法启动","aria-label":'Permalink to "SpringBoot项目引入OpenFeign后无法启动"'},"")],-1),u=d("",38);function f(s,b,m,E,F,v){const e=l,p=o("ClientOnly");return n(),h("div",null,[B,k(p,null,{default:g(()=>{var a,i;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((i=s.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(n(),A(e,{key:0,article:s.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),u])}const L=r(D,[["render",f]]);export{j as __pageData,L as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as l,D as r,o as i,c,I as d,w as h,k as e,a as g,R as u,b as k,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const x="/assets/202209052140666.32--wmK-.png",_="/assets/202209052232777.9wkXHFa6.png",B=JSON.parse('{"title":"Nginx转发请求,报13:Permission denied错误","description":"","frontmatter":{"title":"Nginx转发请求,报13:Permission denied错误","author":"查尔斯","date":"2022/09/05 21:44","categories":["Bug万象集"],"tags":["Linux","Nginx"]},"headers":[],"relativePath":"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md","filePath":"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md","lastUpdated":1662734844000}'),b={name:"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md"},C=e("h1",{id:"nginx转发请求-报13-permission-denied错误",tabindex:"-1"},[g("Nginx转发请求,报13:Permission denied错误 "),e("a",{class:"header-anchor",href:"#nginx转发请求-报13-permission-denied错误","aria-label":'Permalink to "Nginx转发请求,报13:Permission denied错误"'},"")],-1),v=u(`<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 上周五下班前刚给新项目的测试环境添加上了 CI/CD,本以为事情就告一段落了,今天上午前端小伙伴合并了一版到测试环境,然后测试小伙伴就在群里 @ 笔者,问登录验证码怎么出不来了。</p><p>赶紧去测试地址看了一下,发现验证码接口 Nginx 502 了,首先想到的就是后端服务宕了,登上测试环境看了看,人家跑得欢快的很啊,程序日志里也没出现什么错误。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>HTTP 状态码 502:表示作为网关或代理角色的服务器,从上游服务器(如tomcat、php-fpm)中接收到的响应是无效的。</p></div><p>既然错误不在后端服务,那就顺着调用链路往前排查看看,打开 Nginx 错误日志,看看究竟是什么原因导致的 502。</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /var/log/nginx/</span></span>
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as l,D as r,o as i,c,I as d,w as h,k as e,a as g,R as u,b as k,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const x="/assets/202209052140666.32--wmK-.png",_="/assets/202209052232777.9wkXHFa6.png",B=JSON.parse('{"title":"Nginx转发请求,报13:Permission denied错误","description":"","frontmatter":{"title":"Nginx转发请求,报13:Permission denied错误","author":"查尔斯","date":"2022/09/05 21:44","categories":["Bug万象集"],"tags":["Linux","Nginx"]},"headers":[],"relativePath":"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md","filePath":"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md","lastUpdated":1662734844000}'),b={name:"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md"},C=e("h1",{id:"nginx转发请求-报13-permission-denied错误",tabindex:"-1"},[g("Nginx转发请求,报13:Permission denied错误 "),e("a",{class:"header-anchor",href:"#nginx转发请求-报13-permission-denied错误","aria-label":'Permalink to "Nginx转发请求,报13:Permission denied错误"'},"")],-1),v=u(`<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 上周五下班前刚给新项目的测试环境添加上了 CI/CD,本以为事情就告一段落了,今天上午前端小伙伴合并了一版到测试环境,然后测试小伙伴就在群里 @ 笔者,问登录验证码怎么出不来了。</p><p>赶紧去测试地址看了一下,发现验证码接口 Nginx 502 了,首先想到的就是后端服务宕了,登上测试环境看了看,人家跑得欢快的很啊,程序日志里也没出现什么错误。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>HTTP 状态码 502:表示作为网关或代理角色的服务器,从上游服务器(如tomcat、php-fpm)中接收到的响应是无效的。</p></div><p>既然错误不在后端服务,那就顺着调用链路往前排查看看,打开 Nginx 错误日志,看看究竟是什么原因导致的 502。</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /var/log/nginx/</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># 查看错误日志</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">tail</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -50</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> error.log</span></span></code></pre></div><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span>2022/09/05 10:03:47 [crit] 8431#8431: *45 connect() to 127.0.0.1:18005 failed (13: Permission denied) while connecting to upstream, client: xx.xxx.xx.xxx, server: _, request: "GET /api/captcha?_t=1662344535439 HTTP/1.1", upstream: "http://127.0.0.1:18005/captcha?_t=1662344535439", host: "xx.x.xxx.xx", referrer: "http://xx.x.xxx.xx/"</span></span></code></pre></div><p><img src="`+x+`" alt="202208112010100"></p><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>抓住错误关键词 <code>Permission denied</code>,没有权限的意思,笔者突然灵光一现,很早以前安装 Nginx,在启动的时候遇到过一个和权限类似的错误,大意是你不能用 <code>root</code> 直接启动。 Nginx 配置文件中有一个 <code>user</code> 配置,启动 Nginx 需要用对应的用户才能启动,笔者现在是登录的 <code>root</code> 用户,今天 CI/CD 执行后出现这问题了,还是得去确认下 Nginx 配置。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>这个 Nginx 是上周五让网管装的,代理部分配置也是直接复制的另一个项目的发给他就配上了,配完笔者直接用上了,当时手动打包前端传上来也没见出现什么问题。</p></div><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span># For more information on configuration, see:</span></span>
|
||||
<span class="line"><span># * Official English Documentation: http://nginx.org/en/docs/</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as l,D as r,o as i,c,I as d,w as h,k as e,a as g,R as u,b as k,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const x="/assets/202209052140666.32--wmK-.png",_="/assets/202209052232777.9wkXHFa6.png",B=JSON.parse('{"title":"Nginx转发请求,报13:Permission denied错误","description":"","frontmatter":{"title":"Nginx转发请求,报13:Permission denied错误","author":"查尔斯","date":"2022/09/05 21:44","categories":["Bug万象集"],"tags":["Linux","Nginx"]},"headers":[],"relativePath":"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md","filePath":"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md","lastUpdated":1662734844000}'),b={name:"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md"},C=e("h1",{id:"nginx转发请求-报13-permission-denied错误",tabindex:"-1"},[g("Nginx转发请求,报13:Permission denied错误 "),e("a",{class:"header-anchor",href:"#nginx转发请求-报13-permission-denied错误","aria-label":'Permalink to "Nginx转发请求,报13:Permission denied错误"'},"")],-1),v=u("",29);function F(s,f,y,N,q,P){const t=o,p=r("ClientOnly");return i(),c("div",null,[C,d(p,null,{default:h(()=>{var a,n;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((n=s.$frontmatter)==null?void 0:n.showArticleMetadata)??!0)?(i(),k(t,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),v])}const E=l(b,[["render",F]]);export{B as __pageData,E as default};
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as l,D as r,o as i,c,I as d,w as h,k as e,a as g,R as u,b as k,e as m}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const x="/assets/202209052140666.32--wmK-.png",_="/assets/202209052232777.9wkXHFa6.png",B=JSON.parse('{"title":"Nginx转发请求,报13:Permission denied错误","description":"","frontmatter":{"title":"Nginx转发请求,报13:Permission denied错误","author":"查尔斯","date":"2022/09/05 21:44","categories":["Bug万象集"],"tags":["Linux","Nginx"]},"headers":[],"relativePath":"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md","filePath":"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md","lastUpdated":1662734844000}'),b={name:"categories/issues/2022/09/05/Nginx转发请求,报13:Permission denied错误.md"},C=e("h1",{id:"nginx转发请求-报13-permission-denied错误",tabindex:"-1"},[g("Nginx转发请求,报13:Permission denied错误 "),e("a",{class:"header-anchor",href:"#nginx转发请求-报13-permission-denied错误","aria-label":'Permalink to "Nginx转发请求,报13:Permission denied错误"'},"")],-1),v=u("",29);function F(s,f,y,N,q,P){const t=o,p=r("ClientOnly");return i(),c("div",null,[C,d(p,null,{default:h(()=>{var a,n;return[(((a=s.$frontmatter)==null?void 0:a.aside)??!0)&&(((n=s.$frontmatter)==null?void 0:n.showArticleMetadata)??!0)?(i(),k(t,{key:0,article:s.$frontmatter},null,8,["article"])):m("",!0)]}),_:1}),v])}const E=l(b,[["render",F]]);export{B as __pageData,E as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as r,I as d,w as g,k as p,a as A,R as y,b as o,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const q=JSON.parse('{"title":"解决无法重复读取请求体和响应体的问题","description":"","frontmatter":{"title":"解决无法重复读取请求体和响应体的问题","author":"查尔斯","date":"2022/09/23 20:55","categories":["Bug万象集"],"tags":["Java","Spring Boot","过滤器"]},"headers":[],"relativePath":"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md","filePath":"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md","lastUpdated":1664190053000}'),c={name:"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md"},C=p("h1",{id:"解决无法重复读取请求体和响应体的问题",tabindex:"-1"},[A("解决无法重复读取请求体和响应体的问题 "),p("a",{class:"header-anchor",href:"#解决无法重复读取请求体和响应体的问题","aria-label":'Permalink to "解决无法重复读取请求体和响应体的问题"'},"")],-1),B=y(`<h2 id="项目场景" tabindex="-1">项目场景 <a class="header-anchor" href="#项目场景" aria-label="Permalink to "项目场景""></a></h2><p><strong>C:</strong> 这两天实现了一个操作日志功能,需求是要记录指定操作的请求 URL,请求方式、请求头、请求体、响应码、响应头、响应体、请求耗时、操作人、操作IP、操作地址等信息。</p><p>考虑了几种方案,结合以前的经验,排掉了 AOP,综合评估后这次采用的是 Spring 拦截器的方式来记录,大体的实现流程是:</p><ol><li>提供一个 <code>@Log</code> 注解</li><li>在需要记录操作日志的接口类及方法上添加 <code>@Log</code> 注解,指定好资源名称和操作类型(具体为什么要在类和方法上都加,是考虑复用操作的资源名称)</li><li>提供一个拦截器,在拦截器中判断当前 Handler 是否存在 <code>@Log</code> 注解</li><li>存在该注解,就在 <code>preHandle()</code> 中开始计时,在 <code>afterCompletion()</code> 中结束计时并获取请求和响应信息</li><li>将请求和响应信息异步存储到数据库中</li></ol><h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p>流程很简单,但是在获取 requestBody(请求体)和 responseBody(响应体)时出了些问题。如果我在 <code>preHandle()</code> 中获取了请求体信息,那么对应 Handler 就无法获取了,反之如果我是在 <code>afterCompletion</code> 中获取请求体信息,那么就获取不到了。而对于响应体,在我获取完之后,向前端响应就没内容了。</p><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>之所以如此,是由于请求体和响应体分别对应的是 InputStream 和 OutputStream,由于流的特性,使用完之后就无法再被使用了。</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as r,I as d,w as g,k as p,a as A,R as y,b as o,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const q=JSON.parse('{"title":"解决无法重复读取请求体和响应体的问题","description":"","frontmatter":{"title":"解决无法重复读取请求体和响应体的问题","author":"查尔斯","date":"2022/09/23 20:55","categories":["Bug万象集"],"tags":["Java","Spring Boot","过滤器"]},"headers":[],"relativePath":"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md","filePath":"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md","lastUpdated":1664190053000}'),c={name:"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md"},C=p("h1",{id:"解决无法重复读取请求体和响应体的问题",tabindex:"-1"},[A("解决无法重复读取请求体和响应体的问题 "),p("a",{class:"header-anchor",href:"#解决无法重复读取请求体和响应体的问题","aria-label":'Permalink to "解决无法重复读取请求体和响应体的问题"'},"")],-1),B=y(`<h2 id="项目场景" tabindex="-1">项目场景 <a class="header-anchor" href="#项目场景" aria-label="Permalink to "项目场景""></a></h2><p><strong>C:</strong> 这两天实现了一个操作日志功能,需求是要记录指定操作的请求 URL,请求方式、请求头、请求体、响应码、响应头、响应体、请求耗时、操作人、操作IP、操作地址等信息。</p><p>考虑了几种方案,结合以前的经验,排掉了 AOP,综合评估后这次采用的是 Spring 拦截器的方式来记录,大体的实现流程是:</p><ol><li>提供一个 <code>@Log</code> 注解</li><li>在需要记录操作日志的接口类及方法上添加 <code>@Log</code> 注解,指定好资源名称和操作类型(具体为什么要在类和方法上都加,是考虑复用操作的资源名称)</li><li>提供一个拦截器,在拦截器中判断当前 Handler 是否存在 <code>@Log</code> 注解</li><li>存在该注解,就在 <code>preHandle()</code> 中开始计时,在 <code>afterCompletion()</code> 中结束计时并获取请求和响应信息</li><li>将请求和响应信息异步存储到数据库中</li></ol><h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p>流程很简单,但是在获取 requestBody(请求体)和 responseBody(响应体)时出了些问题。如果我在 <code>preHandle()</code> 中获取了请求体信息,那么对应 Handler 就无法获取了,反之如果我是在 <code>afterCompletion</code> 中获取请求体信息,那么就获取不到了。而对于响应体,在我获取完之后,向前端响应就没内容了。</p><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>之所以如此,是由于请求体和响应体分别对应的是 InputStream 和 OutputStream,由于流的特性,使用完之后就无法再被使用了。</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * Retrieves the body of the request as binary data using a {@link ServletInputStream}. Either this method or</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * {@link #getReader} may be called to read the body, not both.</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> *</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as r,I as d,w as g,k as p,a as A,R as y,b as o,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const q=JSON.parse('{"title":"解决无法重复读取请求体和响应体的问题","description":"","frontmatter":{"title":"解决无法重复读取请求体和响应体的问题","author":"查尔斯","date":"2022/09/23 20:55","categories":["Bug万象集"],"tags":["Java","Spring Boot","过滤器"]},"headers":[],"relativePath":"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md","filePath":"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md","lastUpdated":1664190053000}'),c={name:"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md"},C=p("h1",{id:"解决无法重复读取请求体和响应体的问题",tabindex:"-1"},[A("解决无法重复读取请求体和响应体的问题 "),p("a",{class:"header-anchor",href:"#解决无法重复读取请求体和响应体的问题","aria-label":'Permalink to "解决无法重复读取请求体和响应体的问题"'},"")],-1),B=y("",18);function F(s,u,E,m,v,b){const t=l,e=k("ClientOnly");return n(),r("div",null,[C,d(e,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),o(t,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),B])}const R=h(c,[["render",F]]);export{q as __pageData,R as default};
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as r,I as d,w as g,k as p,a as A,R as y,b as o,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const q=JSON.parse('{"title":"解决无法重复读取请求体和响应体的问题","description":"","frontmatter":{"title":"解决无法重复读取请求体和响应体的问题","author":"查尔斯","date":"2022/09/23 20:55","categories":["Bug万象集"],"tags":["Java","Spring Boot","过滤器"]},"headers":[],"relativePath":"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md","filePath":"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md","lastUpdated":1664190053000}'),c={name:"categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题.md"},C=p("h1",{id:"解决无法重复读取请求体和响应体的问题",tabindex:"-1"},[A("解决无法重复读取请求体和响应体的问题 "),p("a",{class:"header-anchor",href:"#解决无法重复读取请求体和响应体的问题","aria-label":'Permalink to "解决无法重复读取请求体和响应体的问题"'},"")],-1),B=y("",18);function F(s,u,E,m,v,b){const t=l,e=k("ClientOnly");return n(),r("div",null,[C,d(e,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),o(t,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),B])}const R=h(c,[["render",F]]);export{q as __pageData,R as default};
|
@@ -1 +1 @@
|
||||
import{_ as n}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as p,o,c as d,I as _,w as l,k as a,a as m,R as w,b as u,e as h}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const g="/assets/202210152119199.SP5rj49w.png",f="/assets/202210152120752.u4JAeLCU.png",W="/assets/202210152132275.Qw6P271e.png",k="/assets/202210152132523.7Jt0VgRP.png",b="/assets/202210152132666.kwEETq84.png",D=JSON.parse('{"title":"解决 Windows 桌面部分快捷方式图标变为空白的问题","description":"","frontmatter":{"title":"解决 Windows 桌面部分快捷方式图标变为空白的问题","author":"查尔斯","date":"2022/10/15 21:10","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md","filePath":"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md","lastUpdated":1667738288000}'),C={name:"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md"},P=a("h1",{id:"解决-windows-桌面部分快捷方式图标变为空白的问题",tabindex:"-1"},[m("解决 Windows 桌面部分快捷方式图标变为空白的问题 "),a("a",{class:"header-anchor",href:"#解决-windows-桌面部分快捷方式图标变为空白的问题","aria-label":'Permalink to "解决 Windows 桌面部分快捷方式图标变为空白的问题"'},"")],-1),T=w('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天把电脑系统从 Windows 11 换回了 Windows 10,使用了半个月的 Windows 11 真是一言难尽。</p><p>换完系统就开始安装一些开发应用,安装了一会儿,突然发现桌面上 draw.io 应用快捷方式的图标变为了空白。</p><p><img src="'+g+'" alt="202210152119199"></p><h2 id="解决方案" tabindex="-1">解决方案 <a class="header-anchor" href="#解决方案" aria-label="Permalink to "解决方案""></a></h2><p>1、打开本地应用数据存储位置(<code>C:\\Users\\用户名\\AppData\\Local</code>)</p><p>按下 Windows + R 键,在弹出的运行对话框中输入 <code>%localappdata%</code>,回车确定。</p><p><img src="'+f+'" alt="202210152120752"></p><p>2、在打开的本地应用数据存储窗口中,找到并删除 <code>Iconcache.db</code> 文件</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>这是图标缓存文件,实际上我们的操作就是要删除图标缓存,让系统重新生成缓存。</p></div><p><img src="'+W+'" alt="202210152132275"></p><p>3、打开任务管理器</p><p>按下 Windows + X 键,在弹出快捷菜单后,按下 T 键。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>或者按 Ctrl + Alt + Delete 键,这个快捷键大家应该更熟悉。</p></div><p>4、重新启动 <code>Windows 资源管理器</code> 应用</p><p>右键单击 <code>Windows 资源管理器</code>,在弹出的菜单中选择 <code>重新启动</code>,屏幕会刷新一下。</p><p><img src="'+k+'" alt="202210152132523"></p><p>这时候回到桌面,就可以看到 draw.io 快捷方式的图标恢复正常显示了。</p><p><img src="'+b+'" alt="202210152132666"></p>',19);function A(e,V,v,N,$,S){const i=n,c=p("ClientOnly");return o(),d("div",null,[P,_(c,null,{default:l(()=>{var t,s;return[(((t=e.$frontmatter)==null?void 0:t.aside)??!0)&&(((s=e.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(o(),u(i,{key:0,article:e.$frontmatter},null,8,["article"])):h("",!0)]}),_:1}),T])}const E=r(C,[["render",A]]);export{D as __pageData,E as default};
|
||||
import{_ as n}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as p,o,c as d,I as _,w as l,k as a,a as m,R as w,b as u,e as h}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const g="/assets/202210152119199.SP5rj49w.png",f="/assets/202210152120752.u4JAeLCU.png",W="/assets/202210152132275.Qw6P271e.png",k="/assets/202210152132523.7Jt0VgRP.png",b="/assets/202210152132666.kwEETq84.png",D=JSON.parse('{"title":"解决 Windows 桌面部分快捷方式图标变为空白的问题","description":"","frontmatter":{"title":"解决 Windows 桌面部分快捷方式图标变为空白的问题","author":"查尔斯","date":"2022/10/15 21:10","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md","filePath":"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md","lastUpdated":1667738288000}'),C={name:"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md"},P=a("h1",{id:"解决-windows-桌面部分快捷方式图标变为空白的问题",tabindex:"-1"},[m("解决 Windows 桌面部分快捷方式图标变为空白的问题 "),a("a",{class:"header-anchor",href:"#解决-windows-桌面部分快捷方式图标变为空白的问题","aria-label":'Permalink to "解决 Windows 桌面部分快捷方式图标变为空白的问题"'},"")],-1),T=w('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天把电脑系统从 Windows 11 换回了 Windows 10,使用了半个月的 Windows 11 真是一言难尽。</p><p>换完系统就开始安装一些开发应用,安装了一会儿,突然发现桌面上 draw.io 应用快捷方式的图标变为了空白。</p><p><img src="'+g+'" alt="202210152119199"></p><h2 id="解决方案" tabindex="-1">解决方案 <a class="header-anchor" href="#解决方案" aria-label="Permalink to "解决方案""></a></h2><p>1、打开本地应用数据存储位置(<code>C:\\Users\\用户名\\AppData\\Local</code>)</p><p>按下 Windows + R 键,在弹出的运行对话框中输入 <code>%localappdata%</code>,回车确定。</p><p><img src="'+f+'" alt="202210152120752"></p><p>2、在打开的本地应用数据存储窗口中,找到并删除 <code>Iconcache.db</code> 文件</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>这是图标缓存文件,实际上我们的操作就是要删除图标缓存,让系统重新生成缓存。</p></div><p><img src="'+W+'" alt="202210152132275"></p><p>3、打开任务管理器</p><p>按下 Windows + X 键,在弹出快捷菜单后,按下 T 键。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>或者按 Ctrl + Alt + Delete 键,这个快捷键大家应该更熟悉。</p></div><p>4、重新启动 <code>Windows 资源管理器</code> 应用</p><p>右键单击 <code>Windows 资源管理器</code>,在弹出的菜单中选择 <code>重新启动</code>,屏幕会刷新一下。</p><p><img src="'+k+'" alt="202210152132523"></p><p>这时候回到桌面,就可以看到 draw.io 快捷方式的图标恢复正常显示了。</p><p><img src="'+b+'" alt="202210152132666"></p>',19);function A(e,V,v,N,$,S){const i=n,c=p("ClientOnly");return o(),d("div",null,[P,_(c,null,{default:l(()=>{var t,s;return[(((t=e.$frontmatter)==null?void 0:t.aside)??!0)&&(((s=e.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(o(),u(i,{key:0,article:e.$frontmatter},null,8,["article"])):h("",!0)]}),_:1}),T])}const E=r(C,[["render",A]]);export{D as __pageData,E as default};
|
@@ -1 +1 @@
|
||||
import{_ as n}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as r,D as p,o,c as d,I as _,w as l,k as a,a as m,R as w,b as u,e as h}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const g="/assets/202210152119199.SP5rj49w.png",f="/assets/202210152120752.u4JAeLCU.png",W="/assets/202210152132275.Qw6P271e.png",k="/assets/202210152132523.7Jt0VgRP.png",b="/assets/202210152132666.kwEETq84.png",D=JSON.parse('{"title":"解决 Windows 桌面部分快捷方式图标变为空白的问题","description":"","frontmatter":{"title":"解决 Windows 桌面部分快捷方式图标变为空白的问题","author":"查尔斯","date":"2022/10/15 21:10","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md","filePath":"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md","lastUpdated":1667738288000}'),C={name:"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md"},P=a("h1",{id:"解决-windows-桌面部分快捷方式图标变为空白的问题",tabindex:"-1"},[m("解决 Windows 桌面部分快捷方式图标变为空白的问题 "),a("a",{class:"header-anchor",href:"#解决-windows-桌面部分快捷方式图标变为空白的问题","aria-label":'Permalink to "解决 Windows 桌面部分快捷方式图标变为空白的问题"'},"")],-1),T=w("",19);function A(e,V,v,N,$,S){const i=n,c=p("ClientOnly");return o(),d("div",null,[P,_(c,null,{default:l(()=>{var t,s;return[(((t=e.$frontmatter)==null?void 0:t.aside)??!0)&&(((s=e.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(o(),u(i,{key:0,article:e.$frontmatter},null,8,["article"])):h("",!0)]}),_:1}),T])}const E=r(C,[["render",A]]);export{D as __pageData,E as default};
|
||||
import{_ as n}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as r,D as p,o,c as d,I as _,w as l,k as a,a as m,R as w,b as u,e as h}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const g="/assets/202210152119199.SP5rj49w.png",f="/assets/202210152120752.u4JAeLCU.png",W="/assets/202210152132275.Qw6P271e.png",k="/assets/202210152132523.7Jt0VgRP.png",b="/assets/202210152132666.kwEETq84.png",D=JSON.parse('{"title":"解决 Windows 桌面部分快捷方式图标变为空白的问题","description":"","frontmatter":{"title":"解决 Windows 桌面部分快捷方式图标变为空白的问题","author":"查尔斯","date":"2022/10/15 21:10","categories":["Bug万象集"],"tags":["Windows"]},"headers":[],"relativePath":"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md","filePath":"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md","lastUpdated":1667738288000}'),C={name:"categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题.md"},P=a("h1",{id:"解决-windows-桌面部分快捷方式图标变为空白的问题",tabindex:"-1"},[m("解决 Windows 桌面部分快捷方式图标变为空白的问题 "),a("a",{class:"header-anchor",href:"#解决-windows-桌面部分快捷方式图标变为空白的问题","aria-label":'Permalink to "解决 Windows 桌面部分快捷方式图标变为空白的问题"'},"")],-1),T=w("",19);function A(e,V,v,N,$,S){const i=n,c=p("ClientOnly");return o(),d("div",null,[P,_(c,null,{default:l(()=>{var t,s;return[(((t=e.$frontmatter)==null?void 0:t.aside)??!0)&&(((s=e.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(o(),u(i,{key:0,article:e.$frontmatter},null,8,["article"])):h("",!0)]}),_:1}),T])}const E=r(C,[["render",A]]);export{D as __pageData,E as default};
|
@@ -1,3 +1,3 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as p,o as s,c as d,I as h,w as c,k as i,a as m,R as u,b as k,e as g}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const C="/assets/202210252119166.98f4SCIq.png",N=JSON.parse(`{"title":"解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题","description":"","frontmatter":{"title":"解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题","author":"查尔斯","date":"2022/10/25 21:20","categories":["Bug万象集"],"tags":["Linux","CentOS"]},"headers":[],"relativePath":"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md","filePath":"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md","lastUpdated":1668325225000}`),y={name:"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md"},_=i("h1",{id:"解决-centos-8-执行-yum-install-报-error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal-mirrorlist-no-urls-in-mirrorlist-的问题",tabindex:"-1"},[m("解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题 "),i("a",{class:"header-anchor",href:"#解决-centos-8-执行-yum-install-报-error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal-mirrorlist-no-urls-in-mirrorlist-的问题","aria-label":`Permalink to "解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题"`},"")],-1),F=u(`<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天,笔者在一台刚重装了 CentOS 8.2 操作系统的云服务器上正打算安装一下 Docker,结果开局安装依赖的环节就报错了。</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span>CentOS Linux 8 - AppStream</span></span>
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as p,o as s,c as d,I as h,w as c,k as i,a as m,R as u,b as k,e as g}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const C="/assets/202210252119166.98f4SCIq.png",N=JSON.parse(`{"title":"解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题","description":"","frontmatter":{"title":"解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题","author":"查尔斯","date":"2022/10/25 21:20","categories":["Bug万象集"],"tags":["Linux","CentOS"]},"headers":[],"relativePath":"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md","filePath":"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md","lastUpdated":1668325225000}`),y={name:"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md"},_=i("h1",{id:"解决-centos-8-执行-yum-install-报-error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal-mirrorlist-no-urls-in-mirrorlist-的问题",tabindex:"-1"},[m("解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题 "),i("a",{class:"header-anchor",href:"#解决-centos-8-执行-yum-install-报-error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal-mirrorlist-no-urls-in-mirrorlist-的问题","aria-label":`Permalink to "解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题"`},"")],-1),F=u(`<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天,笔者在一台刚重装了 CentOS 8.2 操作系统的云服务器上正打算安装一下 Docker,结果开局安装依赖的环节就报错了。</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span>CentOS Linux 8 - AppStream</span></span>
|
||||
<span class="line"><span>Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist</span></span></code></pre></div><p><img src="`+C+`" alt="202210252119166"></p><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>首先排除掉是安装 Docker 引起的错误,因为笔者起初还尝试了下把三个依赖分开安装,想看看是不是由于某个依赖安装引起的,最终发现无论执行 yum 安装哪一个包都会报这个错。</p><p>而从报错信息的字面意思来看,应该是和 yum 的镜像源有关。</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span>错误:从仓库 ‘appstream’ 下载元数据失败:无法准备内部镜像列表:镜像列表中没有 url</span></span></code></pre></div><p>这可就触碰到笔者的盲区部分了,最不擅长的就是这类 Linux 系统的初始配置,所以笔者搜索了一下,发现了一个较为靠谱的答案。</p><blockquote><p>2020 年 12 月 8 号,CentOS 官方宣布了停止维护 CentOS Linux 的计划,并推出了 CentOS Stream 项目,CentOS Linux 8 作为 RHEL 8 的复刻版本,生命周期缩短,于 2021 年 12 月 31 日停止更新并停止维护(EOL),更多的信息可以查看 CentOS 官方公告。[1]</p></blockquote><h2 id="解决方案" tabindex="-1">解决方案 <a class="header-anchor" href="#解决方案" aria-label="Permalink to "解决方案""></a></h2><p>解决起来也较为容易,那就是如果需要更新 CentOS,需要将镜像从 mirror.centos.org 更改为 vault.centos.org。</p><ol><li><p>进入 yum 的 repos 目录</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /etc/yum.repos.d/</span></span></code></pre></div></li><li><p>替换镜像</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">sed</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -i</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> 's/mirrorlist/#mirrorlist/g'</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /etc/yum.repos.d/CentOS-</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">*</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">sed</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -i</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g'</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> /etc/yum.repos.d/CentOS-</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;">*</span></span></code></pre></div></li><li><p>生成缓存</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">yum</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> makecache</span></span></code></pre></div></li><li><p>更新</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">yum</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> -y</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> update</span></span></code></pre></div></li></ol><p>等待更新完之后,再执行 yum 安装就正常了。</p><h2 id="参考资料" tabindex="-1">参考资料 <a class="header-anchor" href="#参考资料" aria-label="Permalink to "参考资料""></a></h2><ol><li>【已解决】Error: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist:<a href="https://blog.csdn.net/weixin_43252521/article/details/124409151" target="_blank" rel="noreferrer">https://blog.csdn.net/weixin_43252521/article/details/124409151</a></li><li>CentOS 8 EOL如何切换源?:<a href="https://help.aliyun.com/document_detail/405635.html" target="_blank" rel="noreferrer">https://help.aliyun.com/document_detail/405635.html</a></li><li>CentOS Project shifts focus to CentOS Stream:<a href="https://blog.centos.org/2020/12/future-is-centos-stream/" target="_blank" rel="noreferrer">https://blog.centos.org/2020/12/future-is-centos-stream/</a></li></ol>`,16);function b(a,f,v,S,O,D){const r=l,n=p("ClientOnly");return s(),d("div",null,[_,h(n,null,{default:c(()=>{var e,t;return[(((e=a.$frontmatter)==null?void 0:e.aside)??!0)&&(((t=a.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(s(),k(r,{key:0,article:a.$frontmatter},null,8,["article"])):g("",!0)]}),_:1}),F])}const q=o(y,[["render",b]]);export{N as __pageData,q as default};
|
@@ -1 +1 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as o,D as p,o as s,c as d,I as h,w as c,k as i,a as m,R as u,b as k,e as g}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const C="/assets/202210252119166.98f4SCIq.png",N=JSON.parse(`{"title":"解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题","description":"","frontmatter":{"title":"解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题","author":"查尔斯","date":"2022/10/25 21:20","categories":["Bug万象集"],"tags":["Linux","CentOS"]},"headers":[],"relativePath":"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md","filePath":"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md","lastUpdated":1668325225000}`),y={name:"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md"},_=i("h1",{id:"解决-centos-8-执行-yum-install-报-error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal-mirrorlist-no-urls-in-mirrorlist-的问题",tabindex:"-1"},[m("解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题 "),i("a",{class:"header-anchor",href:"#解决-centos-8-执行-yum-install-报-error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal-mirrorlist-no-urls-in-mirrorlist-的问题","aria-label":`Permalink to "解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题"`},"")],-1),F=u("",16);function b(a,f,v,S,O,D){const r=l,n=p("ClientOnly");return s(),d("div",null,[_,h(n,null,{default:c(()=>{var e,t;return[(((e=a.$frontmatter)==null?void 0:e.aside)??!0)&&(((t=a.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(s(),k(r,{key:0,article:a.$frontmatter},null,8,["article"])):g("",!0)]}),_:1}),F])}const q=o(y,[["render",b]]);export{N as __pageData,q as default};
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as o,D as p,o as s,c as d,I as h,w as c,k as i,a as m,R as u,b as k,e as g}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const C="/assets/202210252119166.98f4SCIq.png",N=JSON.parse(`{"title":"解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题","description":"","frontmatter":{"title":"解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题","author":"查尔斯","date":"2022/10/25 21:20","categories":["Bug万象集"],"tags":["Linux","CentOS"]},"headers":[],"relativePath":"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md","filePath":"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md","lastUpdated":1668325225000}`),y={name:"categories/issues/2022/10/25/解决CentOS8执行yum安装报错.md"},_=i("h1",{id:"解决-centos-8-执行-yum-install-报-error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal-mirrorlist-no-urls-in-mirrorlist-的问题",tabindex:"-1"},[m("解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题 "),i("a",{class:"header-anchor",href:"#解决-centos-8-执行-yum-install-报-error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal-mirrorlist-no-urls-in-mirrorlist-的问题","aria-label":`Permalink to "解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题"`},"")],-1),F=u("",16);function b(a,f,v,S,O,D){const r=l,n=p("ClientOnly");return s(),d("div",null,[_,h(n,null,{default:c(()=>{var e,t;return[(((e=a.$frontmatter)==null?void 0:e.aside)??!0)&&(((t=a.$frontmatter)==null?void 0:t.showArticleMetadata)??!0)?(s(),k(r,{key:0,article:a.$frontmatter},null,8,["article"])):g("",!0)]}),_:1}),F])}const q=o(y,[["render",b]]);export{N as __pageData,q as default};
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as n}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as r,o as t,c,I as d,w as h,k as i,a as k,R as m,b as g,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202210291930211.n8F_zSQS.png",S=JSON.parse('{"title":"Docker 设置网络代理","description":"","frontmatter":{"title":"Docker 设置网络代理","author":"查尔斯","date":"2022/10/29 19:50","categories":["Bug万象集"],"tags":["Docker","Linux","CentOS","网络代理"]},"headers":[],"relativePath":"categories/issues/2022/10/29/Docker设置网络代理.md","filePath":"categories/issues/2022/10/29/Docker设置网络代理.md","lastUpdated":1667230305000}'),F={name:"categories/issues/2022/10/29/Docker设置网络代理.md"},_=i("h1",{id:"docker-设置网络代理",tabindex:"-1"},[k("Docker 设置网络代理 "),i("a",{class:"header-anchor",href:"#docker-设置网络代理","aria-label":'Permalink to "Docker 设置网络代理"'},"")],-1),v=m("",26);function b(s,C,D,f,T,P){const o=n,l=r("ClientOnly");return t(),c("div",null,[_,d(l,null,{default:h(()=>{var e,a;return[(((e=s.$frontmatter)==null?void 0:e.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),g(o,{key:0,article:s.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),v])}const B=p(F,[["render",b]]);export{S as __pageData,B as default};
|
||||
import{_ as n}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as r,o as t,c,I as d,w as h,k as i,a as k,R as m,b as g,e as u}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202210291930211.n8F_zSQS.png",S=JSON.parse('{"title":"Docker 设置网络代理","description":"","frontmatter":{"title":"Docker 设置网络代理","author":"查尔斯","date":"2022/10/29 19:50","categories":["Bug万象集"],"tags":["Docker","Linux","CentOS","网络代理"]},"headers":[],"relativePath":"categories/issues/2022/10/29/Docker设置网络代理.md","filePath":"categories/issues/2022/10/29/Docker设置网络代理.md","lastUpdated":1667230305000}'),F={name:"categories/issues/2022/10/29/Docker设置网络代理.md"},_=i("h1",{id:"docker-设置网络代理",tabindex:"-1"},[k("Docker 设置网络代理 "),i("a",{class:"header-anchor",href:"#docker-设置网络代理","aria-label":'Permalink to "Docker 设置网络代理"'},"")],-1),v=m("",26);function b(s,C,D,f,T,P){const o=n,l=r("ClientOnly");return t(),c("div",null,[_,d(l,null,{default:h(()=>{var e,a;return[(((e=s.$frontmatter)==null?void 0:e.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(t(),g(o,{key:0,article:s.$frontmatter},null,8,["article"])):u("",!0)]}),_:1}),v])}const B=p(F,[["render",b]]);export{S as __pageData,B as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as h}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as l,D as k,o as e,c as r,I as o,w as d,k as t,a as c,R as g,b as m,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202211042020211.5Fn2sUBC.png",T=JSON.parse('{"title":"解决 Docker 安装 Prometheus 启动报 permission denied 的问题","description":"","frontmatter":{"title":"解决 Docker 安装 Prometheus 启动报 permission denied 的问题","author":"查尔斯","date":"2022/11/04 20:30","categories":["Bug万象集"],"tags":["Prometheus","Docker","Linux"]},"headers":[],"relativePath":"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md","filePath":"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md","lastUpdated":1668350473000}'),D={name:"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md"},y=t("h1",{id:"解决-docker-安装-prometheus-启动报-permission-denied-的问题",tabindex:"-1"},[c("解决 Docker 安装 Prometheus 启动报 permission denied 的问题 "),t("a",{class:"header-anchor",href:"#解决-docker-安装-prometheus-启动报-permission-denied-的问题","aria-label":'Permalink to "解决 Docker 安装 Prometheus 启动报 permission denied 的问题"'},"")],-1),A=g(`<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天,笔者在使用 Docker 安装了 Prometheus 后,发现其容器没有能正常启动,而是处于持续重启的状态。笔者手动尝试了几次重启容器命令,依然如此。</p><p>遇到这种情况,单纯去盯容器运行命令哪里有错误,排查和修复就慢了,不如先看看 Prometheus 容器的日志。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># docker logs 容器ID/容器名称</span></span>
|
||||
import{_ as h}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as l,D as k,o as e,c as r,I as o,w as d,k as t,a as c,R as g,b as m,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202211042020211.5Fn2sUBC.png",T=JSON.parse('{"title":"解决 Docker 安装 Prometheus 启动报 permission denied 的问题","description":"","frontmatter":{"title":"解决 Docker 安装 Prometheus 启动报 permission denied 的问题","author":"查尔斯","date":"2022/11/04 20:30","categories":["Bug万象集"],"tags":["Prometheus","Docker","Linux"]},"headers":[],"relativePath":"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md","filePath":"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md","lastUpdated":1668350473000}'),D={name:"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md"},y=t("h1",{id:"解决-docker-安装-prometheus-启动报-permission-denied-的问题",tabindex:"-1"},[c("解决 Docker 安装 Prometheus 启动报 permission denied 的问题 "),t("a",{class:"header-anchor",href:"#解决-docker-安装-prometheus-启动报-permission-denied-的问题","aria-label":'Permalink to "解决 Docker 安装 Prometheus 启动报 permission denied 的问题"'},"")],-1),A=g(`<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天,笔者在使用 Docker 安装了 Prometheus 后,发现其容器没有能正常启动,而是处于持续重启的状态。笔者手动尝试了几次重启容器命令,依然如此。</p><p>遇到这种情况,单纯去盯容器运行命令哪里有错误,排查和修复就慢了,不如先看看 Prometheus 容器的日志。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"># docker logs 容器ID/容器名称</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> logs</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> prometheus</span></span></code></pre></div><p>在容器日志中,笔者看到了几段重复性的日志内容,很显然这是几次重启容器出现的重复性日志,笔者从中截取了一段相对完整的日志内容。</p><p><img src="`+u+`" alt="202211042020211"></p><p>错误信息部分也很突出,level=error。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">caller</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">query_logger.go:90</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> level</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">error</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> component</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">activeQueryTracker</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> msg</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"Error opening quer log file"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> file</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">/opt/bitnami/prometheus/data/queries.active</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> err</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"open data/queries.active: permission denied"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">panic:</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> Unable</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> to</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> create</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> mmap-ed</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> active</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> query</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;"> log</span></span></code></pre></div><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>简单翻译一下错误信息 msg 及后面部分提示。</p><blockquote><p>信息:打开查询日志文件时出错 file=/opt/bitnami/prometheus/data/queries.active 错误:打开 data/queries.active:拒绝访问</p></blockquote><p>其中的关键信息是 <code>permission denied</code>(拒绝访问),从这字面意思上可以得知和权限有关。</p><p>为了方便大家进行原因分析,笔者把 docker-compose 的 Prometheus 部分脚本贴在下方。</p><div class="language-yaml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">version</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">'3'</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">services</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">:</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as h}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as l,D as k,o as e,c as r,I as o,w as d,k as t,a as c,R as g,b as m,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202211042020211.5Fn2sUBC.png",T=JSON.parse('{"title":"解决 Docker 安装 Prometheus 启动报 permission denied 的问题","description":"","frontmatter":{"title":"解决 Docker 安装 Prometheus 启动报 permission denied 的问题","author":"查尔斯","date":"2022/11/04 20:30","categories":["Bug万象集"],"tags":["Prometheus","Docker","Linux"]},"headers":[],"relativePath":"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md","filePath":"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md","lastUpdated":1668350473000}'),D={name:"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md"},y=t("h1",{id:"解决-docker-安装-prometheus-启动报-permission-denied-的问题",tabindex:"-1"},[c("解决 Docker 安装 Prometheus 启动报 permission denied 的问题 "),t("a",{class:"header-anchor",href:"#解决-docker-安装-prometheus-启动报-permission-denied-的问题","aria-label":'Permalink to "解决 Docker 安装 Prometheus 启动报 permission denied 的问题"'},"")],-1),A=g("",23);function C(s,_,v,b,B,f){const n=h,p=k("ClientOnly");return e(),r("div",null,[y,o(p,null,{default:d(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(e(),m(n,{key:0,article:s.$frontmatter},null,8,["article"])):F("",!0)]}),_:1}),A])}const x=l(D,[["render",C]]);export{T as __pageData,x as default};
|
||||
import{_ as h}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as l,D as k,o as e,c as r,I as o,w as d,k as t,a as c,R as g,b as m,e as F}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const u="/assets/202211042020211.5Fn2sUBC.png",T=JSON.parse('{"title":"解决 Docker 安装 Prometheus 启动报 permission denied 的问题","description":"","frontmatter":{"title":"解决 Docker 安装 Prometheus 启动报 permission denied 的问题","author":"查尔斯","date":"2022/11/04 20:30","categories":["Bug万象集"],"tags":["Prometheus","Docker","Linux"]},"headers":[],"relativePath":"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md","filePath":"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md","lastUpdated":1668350473000}'),D={name:"categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题.md"},y=t("h1",{id:"解决-docker-安装-prometheus-启动报-permission-denied-的问题",tabindex:"-1"},[c("解决 Docker 安装 Prometheus 启动报 permission denied 的问题 "),t("a",{class:"header-anchor",href:"#解决-docker-安装-prometheus-启动报-permission-denied-的问题","aria-label":'Permalink to "解决 Docker 安装 Prometheus 启动报 permission denied 的问题"'},"")],-1),A=g("",23);function C(s,_,v,b,B,f){const n=h,p=k("ClientOnly");return e(),r("div",null,[y,o(p,null,{default:d(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(e(),m(n,{key:0,article:s.$frontmatter},null,8,["article"])):F("",!0)]}),_:1}),A])}const x=l(D,[["render",C]]);export{T as __pageData,x as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as r,o as t,c as p,I as k,w as d,k as e,a as c,R as g,b as u,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const m="/assets/202211061520256.0x2JUDBf.png",C="/assets/202211061523521.dpXxaKfJ.png",T=JSON.parse(`{"title":"解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again","description":"","frontmatter":{"title":"解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again","author":"查尔斯","date":"2022/11/06 15:35","categories":["Bug万象集"],"tags":["DotNet","Linux","CentOS"]},"headers":[],"relativePath":"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md","filePath":"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md","lastUpdated":1668604952000}`),D={name:"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md"},A=e("h1",{id:"解决-dotnet-安装完-报错-couldn-t-find-a-valid-icu-package-installed-on-the-system-please-install-libicu-using-your-package-manager-and-try-again",tabindex:"-1"},[c("解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again "),e("a",{class:"header-anchor",href:"#解决-dotnet-安装完-报错-couldn-t-find-a-valid-icu-package-installed-on-the-system-please-install-libicu-using-your-package-manager-and-try-again","aria-label":`Permalink to "解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again"`},"")],-1),B=g('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天,笔者在一台 CentOS 7.9 服务器上手动安装完 DotNet 6.0.401 并配置好了环境变量之后,照例想查看一下是否安装成功。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">dotnet</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --version</span></span></code></pre></div><p>预想的版本信息没输出,倒是输出了这么一段错误。</p><p><img src="'+m+`" alt="202211061520256"></p><div class="language-c# vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c#</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">Process terminated. Couldn</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">'t find a valid ICU package installed on the system. Please install libicu using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information</span><span style="--shiki-light:#B31D28;--shiki-dark:#FF938A;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">.</span></span>
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as r,o as t,c as p,I as k,w as d,k as e,a as c,R as g,b as u,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const m="/assets/202211061520256.0x2JUDBf.png",C="/assets/202211061523521.dpXxaKfJ.png",T=JSON.parse(`{"title":"解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again","description":"","frontmatter":{"title":"解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again","author":"查尔斯","date":"2022/11/06 15:35","categories":["Bug万象集"],"tags":["DotNet","Linux","CentOS"]},"headers":[],"relativePath":"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md","filePath":"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md","lastUpdated":1668604952000}`),D={name:"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md"},A=e("h1",{id:"解决-dotnet-安装完-报错-couldn-t-find-a-valid-icu-package-installed-on-the-system-please-install-libicu-using-your-package-manager-and-try-again",tabindex:"-1"},[c("解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again "),e("a",{class:"header-anchor",href:"#解决-dotnet-安装完-报错-couldn-t-find-a-valid-icu-package-installed-on-the-system-please-install-libicu-using-your-package-manager-and-try-again","aria-label":`Permalink to "解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again"`},"")],-1),B=g('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 今天,笔者在一台 CentOS 7.9 服务器上手动安装完 DotNet 6.0.401 并配置好了环境变量之后,照例想查看一下是否安装成功。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50;">dotnet</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> --version</span></span></code></pre></div><p>预想的版本信息没输出,倒是输出了这么一段错误。</p><p><img src="'+m+`" alt="202211061520256"></p><div class="language-c# vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c#</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">Process terminated. Couldn</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">'t find a valid ICU package installed on the system. Please install libicu using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information</span><span style="--shiki-light:#B31D28;--shiki-dark:#FF938A;--shiki-light-font-style:italic;--shiki-dark-font-style:italic;">.</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> at System.Environment.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">FailFast</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(System.String)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> at System.Globalization.GlobalizationMode</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">Settings</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">..</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">cctor</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> at System.Globalization.CultureData.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">CreateCultureWithInvariantData</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">()</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as o}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as r,o as t,c as p,I as k,w as d,k as e,a as c,R as g,b as u,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const m="/assets/202211061520256.0x2JUDBf.png",C="/assets/202211061523521.dpXxaKfJ.png",T=JSON.parse(`{"title":"解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again","description":"","frontmatter":{"title":"解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again","author":"查尔斯","date":"2022/11/06 15:35","categories":["Bug万象集"],"tags":["DotNet","Linux","CentOS"]},"headers":[],"relativePath":"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md","filePath":"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md","lastUpdated":1668604952000}`),D={name:"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md"},A=e("h1",{id:"解决-dotnet-安装完-报错-couldn-t-find-a-valid-icu-package-installed-on-the-system-please-install-libicu-using-your-package-manager-and-try-again",tabindex:"-1"},[c("解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again "),e("a",{class:"header-anchor",href:"#解决-dotnet-安装完-报错-couldn-t-find-a-valid-icu-package-installed-on-the-system-please-install-libicu-using-your-package-manager-and-try-again","aria-label":`Permalink to "解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again"`},"")],-1),B=g("",18);function b(a,_,f,F,E,v){const n=o,l=r("ClientOnly");return t(),p("div",null,[A,k(l,null,{default:d(()=>{var s,i;return[(((s=a.$frontmatter)==null?void 0:s.aside)??!0)&&(((i=a.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(t(),u(n,{key:0,article:a.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),B])}const P=h(D,[["render",b]]);export{T as __pageData,P as default};
|
||||
import{_ as o}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as r,o as t,c as p,I as k,w as d,k as e,a as c,R as g,b as u,e as y}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const m="/assets/202211061520256.0x2JUDBf.png",C="/assets/202211061523521.dpXxaKfJ.png",T=JSON.parse(`{"title":"解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again","description":"","frontmatter":{"title":"解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again","author":"查尔斯","date":"2022/11/06 15:35","categories":["Bug万象集"],"tags":["DotNet","Linux","CentOS"]},"headers":[],"relativePath":"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md","filePath":"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md","lastUpdated":1668604952000}`),D={name:"categories/issues/2022/11/06/解决DotNET安装后报错的问题.md"},A=e("h1",{id:"解决-dotnet-安装完-报错-couldn-t-find-a-valid-icu-package-installed-on-the-system-please-install-libicu-using-your-package-manager-and-try-again",tabindex:"-1"},[c("解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again "),e("a",{class:"header-anchor",href:"#解决-dotnet-安装完-报错-couldn-t-find-a-valid-icu-package-installed-on-the-system-please-install-libicu-using-your-package-manager-and-try-again","aria-label":`Permalink to "解决 DotNet 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again"`},"")],-1),B=g("",18);function b(a,_,f,F,E,v){const n=o,l=r("ClientOnly");return t(),p("div",null,[A,k(l,null,{default:d(()=>{var s,i;return[(((s=a.$frontmatter)==null?void 0:s.aside)??!0)&&(((i=a.$frontmatter)==null?void 0:i.showArticleMetadata)??!0)?(t(),u(n,{key:0,article:a.$frontmatter},null,8,["article"])):y("",!0)]}),_:1}),B])}const P=h(D,[["render",b]]);export{T as __pageData,P as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as A,I as g,w as d,k as t,a as r,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202211232120211.hp92Lcjl.png",c="/assets/202211232120226.Kenm8Vxx.png",o="/assets/202211232120521.n5OwLhB0.png",E="/assets/202211232121256.u1sdIYLF.png",u="/assets/202211232121356.KtrXN9k9.png",m="/assets/202211232122166.66iPVkX4.png",S=JSON.parse('{"title":"解决 Maven 传递依赖污染的问题","description":"","frontmatter":{"title":"解决 Maven 传递依赖污染的问题","author":"查尔斯","date":"2022/11/21 21:30","categories":["Bug万象集"],"tags":["Maven","Java"],"showComment":false},"headers":[],"relativePath":"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md","filePath":"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md","lastUpdated":1669216676000}'),v={name:"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md"},I=t("h1",{id:"解决-maven-传递依赖污染的问题",tabindex:"-1"},[r("解决 Maven 传递依赖污染的问题 "),t("a",{class:"header-anchor",href:"#解决-maven-传递依赖污染的问题","aria-label":'Permalink to "解决 Maven 传递依赖污染的问题"'},"")],-1),f=D('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 下午遇到了一个很常见的情况,类似于下图:</p><p>事情是这样的,笔者正想使用 <code>JSON</code> 工具来处理数据,结果 IntelliJ IDEA 提示笔者命名为 <code>JSON</code> 的工具类存在多个,到底要使用哪一个 <code>JSON</code>。</p><p><img src="'+B+'" alt="202211232120211"></p><p>再打开提示,可选择的一共有两个:</p><ol><li>com.alibaba.fastjson.JSON</li><li>com.alibaba.fastjson2.JSON</li></ol><p>很明显,在笔者的项目中引入了 Fastjson、Fastjson2 两个依赖,这两个依赖中都有一个命名为 <code>JSON</code> 的工具类/接口。可问题来了,笔者仅在项目中显式引入了 Fastjson2 依赖,这个 Fastjson 依赖是哪来的?</p><p><img src="'+c+`" alt="202211232120226"></p><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>下面贴上笔者项目的 <code>pom.xml</code>,这当然不是笔者出问题的项目了,为了简单,笔者也没有特意创建父子项目场景,但其中关键的部分就是下面这些。很简单的项目依赖配置,锁定了 JustAuth 和 Fastjson2 的版本,并引入了这两个依赖。</p><div class="language-xml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"><?</span><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">xml</span><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;"> version</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"1.0"</span><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;"> encoding</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"UTF-8"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">?></span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as A,I as g,w as d,k as t,a as r,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202211232120211.hp92Lcjl.png",c="/assets/202211232120226.Kenm8Vxx.png",o="/assets/202211232120521.n5OwLhB0.png",E="/assets/202211232121256.u1sdIYLF.png",u="/assets/202211232121356.KtrXN9k9.png",m="/assets/202211232122166.66iPVkX4.png",S=JSON.parse('{"title":"解决 Maven 传递依赖污染的问题","description":"","frontmatter":{"title":"解决 Maven 传递依赖污染的问题","author":"查尔斯","date":"2022/11/21 21:30","categories":["Bug万象集"],"tags":["Maven","Java"],"showComment":false},"headers":[],"relativePath":"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md","filePath":"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md","lastUpdated":1669216676000}'),v={name:"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md"},I=t("h1",{id:"解决-maven-传递依赖污染的问题",tabindex:"-1"},[r("解决 Maven 传递依赖污染的问题 "),t("a",{class:"header-anchor",href:"#解决-maven-传递依赖污染的问题","aria-label":'Permalink to "解决 Maven 传递依赖污染的问题"'},"")],-1),f=D('<h2 id="问题描述" tabindex="-1">问题描述 <a class="header-anchor" href="#问题描述" aria-label="Permalink to "问题描述""></a></h2><p><strong>C:</strong> 下午遇到了一个很常见的情况,类似于下图:</p><p>事情是这样的,笔者正想使用 <code>JSON</code> 工具来处理数据,结果 IntelliJ IDEA 提示笔者命名为 <code>JSON</code> 的工具类存在多个,到底要使用哪一个 <code>JSON</code>。</p><p><img src="'+B+'" alt="202211232120211"></p><p>再打开提示,可选择的一共有两个:</p><ol><li>com.alibaba.fastjson.JSON</li><li>com.alibaba.fastjson2.JSON</li></ol><p>很明显,在笔者的项目中引入了 Fastjson、Fastjson2 两个依赖,这两个依赖中都有一个命名为 <code>JSON</code> 的工具类/接口。可问题来了,笔者仅在项目中显式引入了 Fastjson2 依赖,这个 Fastjson 依赖是哪来的?</p><p><img src="'+c+`" alt="202211232120226"></p><h2 id="原因分析" tabindex="-1">原因分析 <a class="header-anchor" href="#原因分析" aria-label="Permalink to "原因分析""></a></h2><p>下面贴上笔者项目的 <code>pom.xml</code>,这当然不是笔者出问题的项目了,为了简单,笔者也没有特意创建父子项目场景,但其中关键的部分就是下面这些。很简单的项目依赖配置,锁定了 JustAuth 和 Fastjson2 的版本,并引入了这两个依赖。</p><div class="language-xml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"><?</span><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">xml</span><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;"> version</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"1.0"</span><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;"> encoding</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"UTF-8"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">?></span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"><</span><span style="--shiki-light:#22863A;--shiki-dark:#8DDB8C;">project</span><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;"> xmlns</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"http://maven.apache.org/POM/4.0.0"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;"> xmlns:xsi</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"http://www.w3.org/2001/XMLSchema-instance"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#6CB6FF;"> xsi:schemaLocation</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">></span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as k,D as e,o as n,c as A,I as g,w as d,k as t,a as r,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202211232120211.hp92Lcjl.png",c="/assets/202211232120226.Kenm8Vxx.png",o="/assets/202211232120521.n5OwLhB0.png",E="/assets/202211232121256.u1sdIYLF.png",u="/assets/202211232121356.KtrXN9k9.png",m="/assets/202211232122166.66iPVkX4.png",S=JSON.parse('{"title":"解决 Maven 传递依赖污染的问题","description":"","frontmatter":{"title":"解决 Maven 传递依赖污染的问题","author":"查尔斯","date":"2022/11/21 21:30","categories":["Bug万象集"],"tags":["Maven","Java"],"showComment":false},"headers":[],"relativePath":"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md","filePath":"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md","lastUpdated":1669216676000}'),v={name:"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md"},I=t("h1",{id:"解决-maven-传递依赖污染的问题",tabindex:"-1"},[r("解决 Maven 传递依赖污染的问题 "),t("a",{class:"header-anchor",href:"#解决-maven-传递依赖污染的问题","aria-label":'Permalink to "解决 Maven 传递依赖污染的问题"'},"")],-1),f=D("",29);function _(s,j,b,F,J,x){const l=p,h=e("ClientOnly");return n(),A("div",null,[I,g(h,null,{default:d(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(l,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),f])}const q=k(v,[["render",_]]);export{S as __pageData,q as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as k,D as e,o as n,c as A,I as g,w as d,k as t,a as r,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202211232120211.hp92Lcjl.png",c="/assets/202211232120226.Kenm8Vxx.png",o="/assets/202211232120521.n5OwLhB0.png",E="/assets/202211232121256.u1sdIYLF.png",u="/assets/202211232121356.KtrXN9k9.png",m="/assets/202211232122166.66iPVkX4.png",S=JSON.parse('{"title":"解决 Maven 传递依赖污染的问题","description":"","frontmatter":{"title":"解决 Maven 传递依赖污染的问题","author":"查尔斯","date":"2022/11/21 21:30","categories":["Bug万象集"],"tags":["Maven","Java"],"showComment":false},"headers":[],"relativePath":"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md","filePath":"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md","lastUpdated":1669216676000}'),v={name:"categories/issues/2022/11/23/解决Maven传递依赖污染的问题.md"},I=t("h1",{id:"解决-maven-传递依赖污染的问题",tabindex:"-1"},[r("解决 Maven 传递依赖污染的问题 "),t("a",{class:"header-anchor",href:"#解决-maven-传递依赖污染的问题","aria-label":'Permalink to "解决 Maven 传递依赖污染的问题"'},"")],-1),f=D("",29);function _(s,j,b,F,J,x){const l=p,h=e("ClientOnly");return n(),A("div",null,[I,g(h,null,{default:d(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(l,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),f])}const q=k(v,[["render",_]]);export{S as __pageData,q as default};
|
@@ -1 +1 @@
|
||||
import{_ as i}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as l,D as c,o,c as d,I as m,w as u,k as e,a as p,b as _,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"Bug万象集","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/issues/index.md","filePath":"categories/issues/index.md","lastUpdated":1660643589000}'),h={name:"categories/issues/index.md"},g=e("h1",{id:"bug万象集",tabindex:"-1"},[p("Bug万象集 "),e("a",{class:"header-anchor",href:"#bug万象集","aria-label":'Permalink to "Bug万象集"'},"")],-1),k=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,"你读过的书,遇过的人,扛过的事,写过的 Bug,构成了你作为开发者的人生格局。")],-1);function B(t,b,x,$,C,w){const n=i,r=c("ClientOnly");return o(),d("div",null,[g,m(r,null,{default:u(()=>{var a,s;return[(((a=t.$frontmatter)==null?void 0:a.aside)??!0)&&(((s=t.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(o(),_(n,{key:0,article:t.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),k])}const A=l(h,[["render",B]]);export{y as __pageData,A as default};
|
||||
import{_ as i}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as l,D as c,o,c as d,I as m,w as u,k as e,a as p,b as _,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"Bug万象集","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/issues/index.md","filePath":"categories/issues/index.md","lastUpdated":1660643589000}'),h={name:"categories/issues/index.md"},g=e("h1",{id:"bug万象集",tabindex:"-1"},[p("Bug万象集 "),e("a",{class:"header-anchor",href:"#bug万象集","aria-label":'Permalink to "Bug万象集"'},"")],-1),k=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,"你读过的书,遇过的人,扛过的事,写过的 Bug,构成了你作为开发者的人生格局。")],-1);function B(t,b,x,$,C,w){const n=i,r=c("ClientOnly");return o(),d("div",null,[g,m(r,null,{default:u(()=>{var a,s;return[(((a=t.$frontmatter)==null?void 0:a.aside)??!0)&&(((s=t.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(o(),_(n,{key:0,article:t.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),k])}const A=l(h,[["render",B]]);export{y as __pageData,A as default};
|
@@ -1 +1 @@
|
||||
import{_ as i}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as l,D as c,o,c as d,I as m,w as u,k as e,a as p,b as _,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"Bug万象集","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/issues/index.md","filePath":"categories/issues/index.md","lastUpdated":1660643589000}'),h={name:"categories/issues/index.md"},g=e("h1",{id:"bug万象集",tabindex:"-1"},[p("Bug万象集 "),e("a",{class:"header-anchor",href:"#bug万象集","aria-label":'Permalink to "Bug万象集"'},"")],-1),k=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,"你读过的书,遇过的人,扛过的事,写过的 Bug,构成了你作为开发者的人生格局。")],-1);function B(t,b,x,$,C,w){const n=i,r=c("ClientOnly");return o(),d("div",null,[g,m(r,null,{default:u(()=>{var a,s;return[(((a=t.$frontmatter)==null?void 0:a.aside)??!0)&&(((s=t.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(o(),_(n,{key:0,article:t.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),k])}const A=l(h,[["render",B]]);export{y as __pageData,A as default};
|
||||
import{_ as i}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as l,D as c,o,c as d,I as m,w as u,k as e,a as p,b as _,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"Bug万象集","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/issues/index.md","filePath":"categories/issues/index.md","lastUpdated":1660643589000}'),h={name:"categories/issues/index.md"},g=e("h1",{id:"bug万象集",tabindex:"-1"},[p("Bug万象集 "),e("a",{class:"header-anchor",href:"#bug万象集","aria-label":'Permalink to "Bug万象集"'},"")],-1),k=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,"你读过的书,遇过的人,扛过的事,写过的 Bug,构成了你作为开发者的人生格局。")],-1);function B(t,b,x,$,C,w){const n=i,r=c("ClientOnly");return o(),d("div",null,[g,m(r,null,{default:u(()=>{var a,s;return[(((a=t.$frontmatter)==null?void 0:a.aside)??!0)&&(((s=t.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(o(),_(n,{key:0,article:t.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),k])}const A=l(h,[["render",B]]);export{y as __pageData,A as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as k}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as n,c as r,I as d,w as A,k as t,a as g,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"用Java8获取近N天日期","description":"","frontmatter":{"title":"用Java8获取近N天日期","author":"查尔斯","date":"2021/11/18 20:55","categories":["方案春秋志"],"tags":["Java"]},"headers":[],"relativePath":"categories/solutions/2021/11/18/用Java8获取近N天日期.md","filePath":"categories/solutions/2021/11/18/用Java8获取近N天日期.md","lastUpdated":1660404656000}'),F={name:"categories/solutions/2021/11/18/用Java8获取近N天日期.md"},c=t("h1",{id:"用java8获取近n天日期",tabindex:"-1"},[g("用Java8获取近N天日期 "),t("a",{class:"header-anchor",href:"#用java8获取近n天日期","aria-label":'Permalink to "用Java8获取近N天日期"'},"")],-1),B=y(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 登录进入管理类系统,首页一般都是以展示数据仪表盘为主。例如:展示一些总量、展示近一周或是近 N 天的某数据的折线图、柱状图等等。</p><p>那在展示这类近 N 天的图表时,后端必然要给前端提供一个近 N 天的日期集合用于显示。</p><p>至于实现的方法也有很多种,笔者在这儿就记录一种目前看来扩展性相对较好的方案。</p><h2 id="涉及技术栈" tabindex="-1">涉及技术栈 <a class="header-anchor" href="#涉及技术栈" aria-label="Permalink to "涉及技术栈""></a></h2><ul><li>Spring Boot 2.3.1.RELEASE</li><li>MyBatis Plus 3.1.0(使用了 MyBatis Plus 的代码生成器)</li></ul><h2 id="controller层" tabindex="-1">Controller层 <a class="header-anchor" href="#controller层" aria-label="Permalink to "Controller层""></a></h2><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
import{_ as k}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as n,c as r,I as d,w as A,k as t,a as g,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"用Java8获取近N天日期","description":"","frontmatter":{"title":"用Java8获取近N天日期","author":"查尔斯","date":"2021/11/18 20:55","categories":["方案春秋志"],"tags":["Java"]},"headers":[],"relativePath":"categories/solutions/2021/11/18/用Java8获取近N天日期.md","filePath":"categories/solutions/2021/11/18/用Java8获取近N天日期.md","lastUpdated":1660404656000}'),F={name:"categories/solutions/2021/11/18/用Java8获取近N天日期.md"},c=t("h1",{id:"用java8获取近n天日期",tabindex:"-1"},[g("用Java8获取近N天日期 "),t("a",{class:"header-anchor",href:"#用java8获取近n天日期","aria-label":'Permalink to "用Java8获取近N天日期"'},"")],-1),B=y(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 登录进入管理类系统,首页一般都是以展示数据仪表盘为主。例如:展示一些总量、展示近一周或是近 N 天的某数据的折线图、柱状图等等。</p><p>那在展示这类近 N 天的图表时,后端必然要给前端提供一个近 N 天的日期集合用于显示。</p><p>至于实现的方法也有很多种,笔者在这儿就记录一种目前看来扩展性相对较好的方案。</p><h2 id="涉及技术栈" tabindex="-1">涉及技术栈 <a class="header-anchor" href="#涉及技术栈" aria-label="Permalink to "涉及技术栈""></a></h2><ul><li>Spring Boot 2.3.1.RELEASE</li><li>MyBatis Plus 3.1.0(使用了 MyBatis Plus 的代码生成器)</li></ul><h2 id="controller层" tabindex="-1">Controller层 <a class="header-anchor" href="#controller层" aria-label="Permalink to "Controller层""></a></h2><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * 统计控制器</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> *</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">@author</span><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> Charles7c</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as k}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as n,c as r,I as d,w as A,k as t,a as g,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"用Java8获取近N天日期","description":"","frontmatter":{"title":"用Java8获取近N天日期","author":"查尔斯","date":"2021/11/18 20:55","categories":["方案春秋志"],"tags":["Java"]},"headers":[],"relativePath":"categories/solutions/2021/11/18/用Java8获取近N天日期.md","filePath":"categories/solutions/2021/11/18/用Java8获取近N天日期.md","lastUpdated":1660404656000}'),F={name:"categories/solutions/2021/11/18/用Java8获取近N天日期.md"},c=t("h1",{id:"用java8获取近n天日期",tabindex:"-1"},[g("用Java8获取近N天日期 "),t("a",{class:"header-anchor",href:"#用java8获取近n天日期","aria-label":'Permalink to "用Java8获取近N天日期"'},"")],-1),B=y("",11);function o(s,E,u,m,q,v){const h=k,l=e("ClientOnly");return n(),r("div",null,[c,d(l,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),D(h,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),B])}const M=p(F,[["render",o]]);export{f as __pageData,M as default};
|
||||
import{_ as k}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as n,c as r,I as d,w as A,k as t,a as g,R as y,b as D,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const f=JSON.parse('{"title":"用Java8获取近N天日期","description":"","frontmatter":{"title":"用Java8获取近N天日期","author":"查尔斯","date":"2021/11/18 20:55","categories":["方案春秋志"],"tags":["Java"]},"headers":[],"relativePath":"categories/solutions/2021/11/18/用Java8获取近N天日期.md","filePath":"categories/solutions/2021/11/18/用Java8获取近N天日期.md","lastUpdated":1660404656000}'),F={name:"categories/solutions/2021/11/18/用Java8获取近N天日期.md"},c=t("h1",{id:"用java8获取近n天日期",tabindex:"-1"},[g("用Java8获取近N天日期 "),t("a",{class:"header-anchor",href:"#用java8获取近n天日期","aria-label":'Permalink to "用Java8获取近N天日期"'},"")],-1),B=y("",11);function o(s,E,u,m,q,v){const h=k,l=e("ClientOnly");return n(),r("div",null,[c,d(l,null,{default:A(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),D(h,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),B])}const M=p(F,[["render",o]]);export{f as __pageData,M as default};
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as l}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as h,c as r,I as d,w as F,k,a as A,R as g,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const T=JSON.parse('{"title":"一条SQL查询今年每月统计信息","description":"","frontmatter":{"title":"一条SQL查询今年每月统计信息","author":"查尔斯","date":"2021/11/22 18:22","categories":["方案春秋志"],"tags":["SQL"]},"headers":[],"relativePath":"categories/solutions/2021/11/22/一条SQL查询今年每月统计信息.md","filePath":"categories/solutions/2021/11/22/一条SQL查询今年每月统计信息.md","lastUpdated":1660404656000}'),D={name:"categories/solutions/2021/11/22/一条SQL查询今年每月统计信息.md"},E=k("h1",{id:"一条sql查询今年每月统计信息",tabindex:"-1"},[A("一条SQL查询今年每月统计信息 "),k("a",{class:"header-anchor",href:"#一条sql查询今年每月统计信息","aria-label":'Permalink to "一条SQL查询今年每月统计信息"'},"")],-1),o=g("",15);function c(s,B,S,N,u,H){const t=l,n=e("ClientOnly");return h(),r("div",null,[E,d(n,null,{default:F(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(h(),y(t,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),o])}const q=p(D,[["render",c]]);export{T as __pageData,q as default};
|
||||
import{_ as l}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as h,c as r,I as d,w as F,k,a as A,R as g,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const T=JSON.parse('{"title":"一条SQL查询今年每月统计信息","description":"","frontmatter":{"title":"一条SQL查询今年每月统计信息","author":"查尔斯","date":"2021/11/22 18:22","categories":["方案春秋志"],"tags":["SQL"]},"headers":[],"relativePath":"categories/solutions/2021/11/22/一条SQL查询今年每月统计信息.md","filePath":"categories/solutions/2021/11/22/一条SQL查询今年每月统计信息.md","lastUpdated":1660404656000}'),D={name:"categories/solutions/2021/11/22/一条SQL查询今年每月统计信息.md"},E=k("h1",{id:"一条sql查询今年每月统计信息",tabindex:"-1"},[A("一条SQL查询今年每月统计信息 "),k("a",{class:"header-anchor",href:"#一条sql查询今年每月统计信息","aria-label":'Permalink to "一条SQL查询今年每月统计信息"'},"")],-1),o=g("",15);function c(s,B,S,N,u,H){const t=l,n=e("ClientOnly");return h(),r("div",null,[E,d(n,null,{default:F(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(h(),y(t,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),o])}const q=p(D,[["render",c]]);export{T as __pageData,q as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as t}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as n,c as r,I as d,w as g,k as h,a as A,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202209072221666.9RXCf8CU.png",c="/assets/202209072245777.wwMGIEfI.png",f=JSON.parse('{"title":"递归查询树型结构数据的性能优化方案","description":"","frontmatter":{"title":"递归查询树型结构数据的性能优化方案","author":"查尔斯","date":"2022/09/07 21:05","categories":["方案春秋志"],"tags":["Java","递归","性能优化"]},"headers":[],"relativePath":"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md","filePath":"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md","lastUpdated":1662563767000}'),F={name:"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md"},E=h("h1",{id:"递归查询树型结构数据的性能优化方案",tabindex:"-1"},[A("递归查询树型结构数据的性能优化方案 "),h("a",{class:"header-anchor",href:"#递归查询树型结构数据的性能优化方案","aria-label":'Permalink to "递归查询树型结构数据的性能优化方案"'},"")],-1),o=D(`<p><strong>C:</strong> 在日常开发中,像系统菜单、文件目录、多级分类这样的树型结构业务数据,我们往往会采用递归的方式来完成数据的查询处理。</p><p>递归查询数据的确很方便,但稍微不注意就会造成较大的性能损耗,今天笔者就简单介绍一种优化方案。</p><h2 id="sql递归查询方案" tabindex="-1">SQL递归查询方案 <a class="header-anchor" href="#sql递归查询方案" aria-label="Permalink to "SQL递归查询方案""></a></h2><div class="tip custom-block"><p class="custom-block-title">查询思路</p><ol><li>SQL 查询一级数据</li><li>遍历一级数据</li><li>通过一级数据 <strong>递归</strong> SQL 查询二级...等子级数据</li></ol></div><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"></span>
|
||||
import{_ as t}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as n,c as r,I as d,w as g,k as h,a as A,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202209072221666.9RXCf8CU.png",c="/assets/202209072245777.wwMGIEfI.png",f=JSON.parse('{"title":"递归查询树型结构数据的性能优化方案","description":"","frontmatter":{"title":"递归查询树型结构数据的性能优化方案","author":"查尔斯","date":"2022/09/07 21:05","categories":["方案春秋志"],"tags":["Java","递归","性能优化"]},"headers":[],"relativePath":"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md","filePath":"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md","lastUpdated":1662563767000}'),F={name:"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md"},E=h("h1",{id:"递归查询树型结构数据的性能优化方案",tabindex:"-1"},[A("递归查询树型结构数据的性能优化方案 "),h("a",{class:"header-anchor",href:"#递归查询树型结构数据的性能优化方案","aria-label":'Permalink to "递归查询树型结构数据的性能优化方案"'},"")],-1),o=D(`<p><strong>C:</strong> 在日常开发中,像系统菜单、文件目录、多级分类这样的树型结构业务数据,我们往往会采用递归的方式来完成数据的查询处理。</p><p>递归查询数据的确很方便,但稍微不注意就会造成较大的性能损耗,今天笔者就简单介绍一种优化方案。</p><h2 id="sql递归查询方案" tabindex="-1">SQL递归查询方案 <a class="header-anchor" href="#sql递归查询方案" aria-label="Permalink to "SQL递归查询方案""></a></h2><div class="tip custom-block"><p class="custom-block-title">查询思路</p><ol><li>SQL 查询一级数据</li><li>遍历一级数据</li><li>通过一级数据 <strong>递归</strong> SQL 查询二级...等子级数据</li></ol></div><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * 根据字典码查询树型字典</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> *</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as t}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as p,D as e,o as n,c as r,I as d,w as g,k as h,a as A,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202209072221666.9RXCf8CU.png",c="/assets/202209072245777.wwMGIEfI.png",f=JSON.parse('{"title":"递归查询树型结构数据的性能优化方案","description":"","frontmatter":{"title":"递归查询树型结构数据的性能优化方案","author":"查尔斯","date":"2022/09/07 21:05","categories":["方案春秋志"],"tags":["Java","递归","性能优化"]},"headers":[],"relativePath":"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md","filePath":"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md","lastUpdated":1662563767000}'),F={name:"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md"},E=h("h1",{id:"递归查询树型结构数据的性能优化方案",tabindex:"-1"},[A("递归查询树型结构数据的性能优化方案 "),h("a",{class:"header-anchor",href:"#递归查询树型结构数据的性能优化方案","aria-label":'Permalink to "递归查询树型结构数据的性能优化方案"'},"")],-1),o=D("",14);function u(s,m,L,v,I,V){const l=t,k=e("ClientOnly");return n(),r("div",null,[E,d(k,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(l,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),o])}const K=p(F,[["render",u]]);export{f as __pageData,K as default};
|
||||
import{_ as t}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as p,D as e,o as n,c as r,I as d,w as g,k as h,a as A,R as D,b as y,e as C}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const B="/assets/202209072221666.9RXCf8CU.png",c="/assets/202209072245777.wwMGIEfI.png",f=JSON.parse('{"title":"递归查询树型结构数据的性能优化方案","description":"","frontmatter":{"title":"递归查询树型结构数据的性能优化方案","author":"查尔斯","date":"2022/09/07 21:05","categories":["方案春秋志"],"tags":["Java","递归","性能优化"]},"headers":[],"relativePath":"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md","filePath":"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md","lastUpdated":1662563767000}'),F={name:"categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案.md"},E=h("h1",{id:"递归查询树型结构数据的性能优化方案",tabindex:"-1"},[A("递归查询树型结构数据的性能优化方案 "),h("a",{class:"header-anchor",href:"#递归查询树型结构数据的性能优化方案","aria-label":'Permalink to "递归查询树型结构数据的性能优化方案"'},"")],-1),o=D("",14);function u(s,m,L,v,I,V){const l=t,k=e("ClientOnly");return n(),r("div",null,[E,d(k,null,{default:g(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),y(l,{key:0,article:s.$frontmatter},null,8,["article"])):C("",!0)]}),_:1}),o])}const K=p(F,[["render",u]]);export{f as __pageData,K as default};
|
@@ -1 +1 @@
|
||||
import{_ as i}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as c,D as d,o as n,c as m,I as p,w as _,k as e,a,b as u,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"方案春秋志","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/solutions/index.md","filePath":"categories/solutions/index.md","lastUpdated":1660643589000}'),h={name:"categories/solutions/index.md"},k=e("h1",{id:"方案春秋志",tabindex:"-1"},[a("方案春秋志 "),e("a",{class:"header-anchor",href:"#方案春秋志","aria-label":'Permalink to "方案春秋志"'},"")],-1),x=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,[a("上学的时候除了有错题本之外,一般还会额外准备一个用来记录名言佳剧的本子,按当时的意图是希望日积月累来提升写作能力。"),e("br"),a(" 在写代码的时候,经常会想到或遇到一些小方案,在此记录下来,大抵亦是如此。")])],-1);function $(t,b,C,g,w,N){const r=i,l=d("ClientOnly");return n(),m("div",null,[k,p(l,null,{default:_(()=>{var o,s;return[(((o=t.$frontmatter)==null?void 0:o.aside)??!0)&&(((s=t.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(n(),u(r,{key:0,article:t.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),x])}const A=c(h,[["render",$]]);export{y as __pageData,A as default};
|
||||
import{_ as i}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as c,D as d,o as n,c as m,I as p,w as _,k as e,a,b as u,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"方案春秋志","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/solutions/index.md","filePath":"categories/solutions/index.md","lastUpdated":1660643589000}'),h={name:"categories/solutions/index.md"},k=e("h1",{id:"方案春秋志",tabindex:"-1"},[a("方案春秋志 "),e("a",{class:"header-anchor",href:"#方案春秋志","aria-label":'Permalink to "方案春秋志"'},"")],-1),x=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,[a("上学的时候除了有错题本之外,一般还会额外准备一个用来记录名言佳剧的本子,按当时的意图是希望日积月累来提升写作能力。"),e("br"),a(" 在写代码的时候,经常会想到或遇到一些小方案,在此记录下来,大抵亦是如此。")])],-1);function $(t,b,C,g,w,N){const r=i,l=d("ClientOnly");return n(),m("div",null,[k,p(l,null,{default:_(()=>{var o,s;return[(((o=t.$frontmatter)==null?void 0:o.aside)??!0)&&(((s=t.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(n(),u(r,{key:0,article:t.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),x])}const A=c(h,[["render",$]]);export{y as __pageData,A as default};
|
@@ -1 +1 @@
|
||||
import{_ as i}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as c,D as d,o as n,c as m,I as p,w as _,k as e,a,b as u,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"方案春秋志","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/solutions/index.md","filePath":"categories/solutions/index.md","lastUpdated":1660643589000}'),h={name:"categories/solutions/index.md"},k=e("h1",{id:"方案春秋志",tabindex:"-1"},[a("方案春秋志 "),e("a",{class:"header-anchor",href:"#方案春秋志","aria-label":'Permalink to "方案春秋志"'},"")],-1),x=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,[a("上学的时候除了有错题本之外,一般还会额外准备一个用来记录名言佳剧的本子,按当时的意图是希望日积月累来提升写作能力。"),e("br"),a(" 在写代码的时候,经常会想到或遇到一些小方案,在此记录下来,大抵亦是如此。")])],-1);function $(t,b,C,g,w,N){const r=i,l=d("ClientOnly");return n(),m("div",null,[k,p(l,null,{default:_(()=>{var o,s;return[(((o=t.$frontmatter)==null?void 0:o.aside)??!0)&&(((s=t.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(n(),u(r,{key:0,article:t.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),x])}const A=c(h,[["render",$]]);export{y as __pageData,A as default};
|
||||
import{_ as i}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as c,D as d,o as n,c as m,I as p,w as _,k as e,a,b as u,e as f}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y=JSON.parse('{"title":"方案春秋志","description":"","frontmatter":{"showArticleMetadata":false,"editLink":false,"lastUpdated":false,"showComment":false},"headers":[],"relativePath":"categories/solutions/index.md","filePath":"categories/solutions/index.md","lastUpdated":1660643589000}'),h={name:"categories/solutions/index.md"},k=e("h1",{id:"方案春秋志",tabindex:"-1"},[a("方案春秋志 "),e("a",{class:"header-anchor",href:"#方案春秋志","aria-label":'Permalink to "方案春秋志"'},"")],-1),x=e("div",{class:"tip custom-block"},[e("p",{class:"custom-block-title"},"笔者说"),e("p",null,[a("上学的时候除了有错题本之外,一般还会额外准备一个用来记录名言佳剧的本子,按当时的意图是希望日积月累来提升写作能力。"),e("br"),a(" 在写代码的时候,经常会想到或遇到一些小方案,在此记录下来,大抵亦是如此。")])],-1);function $(t,b,C,g,w,N){const r=i,l=d("ClientOnly");return n(),m("div",null,[k,p(l,null,{default:_(()=>{var o,s;return[(((o=t.$frontmatter)==null?void 0:o.aside)??!0)&&(((s=t.$frontmatter)==null?void 0:s.showArticleMetadata)??!0)?(n(),u(r,{key:0,article:t.$frontmatter},null,8,["article"])):f("",!0)]}),_:1}),x])}const A=c(h,[["render",$]]);export{y as __pageData,A as default};
|
@@ -1,4 +1,4 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as t,a as c,R as g,b as A,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202101140900566.GRVNJqY2.jpg",C="/assets/202101140900568.6-iC6zPC.png",B="/assets/202101140900569.cq5x66L3.png",F="/assets/202101140900570.kMeoNMKw.png",u="/assets/202101140900571.uj-hUiC2.png",m="/assets/202101140900572.lXZNPP9Y.png",E="/assets/202101140900573.QBOmB1fA.png",b="/assets/202101140900575.bAuECzZ8.png",v="/assets/202101140900577.F735cngj.png",q="/assets/202101140900579.I-5b_8Kx.png",_="/assets/202101140900581.XXXuBp3y.png",P="/assets/202101140900583.qlii1KmT.png",f="/assets/202101140900585.__0oxGX-.png",S="/assets/202101140900587.os2J-xs1.png",j="/assets/202101140900589.lsBA9RI2.png",L="/assets/202101140900591.BVGjVcj4.png",I="/assets/202101140900593.LPTwLgzx.png",x="/assets/202101140900595.19mfgMD7.png",J="/assets/202101140900597.LaHmCPti.png",K=JSON.parse('{"title":"初识 Lombok","description":"","frontmatter":{"title":"初识 Lombok","author":"查尔斯","date":"2021/01/14 09:05","categories":["工具四海谈"],"tags":["Java","Lombok"]},"headers":[],"relativePath":"categories/tools/2021/01/14/初识Lombok.md","filePath":"categories/tools/2021/01/14/初识Lombok.md","lastUpdated":1667545308000}'),N={name:"categories/tools/2021/01/14/初识Lombok.md"},w=t("h1",{id:"初识-lombok",tabindex:"-1"},[c("初识 Lombok "),t("a",{class:"header-anchor",href:"#初识-lombok","aria-label":'Permalink to "初识 Lombok"'},"")],-1),T=g(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 在 Java 开发中,为了符合 <code>封装</code> 这一面向对象特性,在构建 JavaBean 时往往要加上 <code>getter/setter</code> 方法。</p><p>在封装的概念里,<code>getter</code> 和 <code>setter</code> 方法是我们提供给外界的统一访问入口,我们可以在其中添加合理的逻辑控制语句,来处理一些业务或解决一些不合理的赋值,非常好的特性!</p><p>但现代开发的实际使用中,我们编写的 JavaBean 的 <code>getter/setter</code> 方法体都是空的,显得非常冗余,但又不能去除。对此,我们在每次使用时,只能通过反复的心理暗示(IDE 自动生成快捷键、生成不费事儿)来麻痹自己。</p><p>Eclipse 中是 <code>Alt + Shift+S > R</code>,IntelliJ IDEA 中是 <code>[FN] + Alt+Insert > Getter and Setter</code>。</p><p>笔者相信,这些快捷键大家都很熟悉,甚至不只是它们,一般我们还会用上无参构造、带参构造、重写 <code>toString</code>、重写 <code>equals</code> 、<code>hashCode</code> 等生成快捷键,每次创建 JavaBean,写完属性之后就是一通 "火花带闪电" 快速生成,就像下面的代码一样。</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as t,a as c,R as g,b as A,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202101140900566.GRVNJqY2.jpg",C="/assets/202101140900568.6-iC6zPC.png",B="/assets/202101140900569.cq5x66L3.png",F="/assets/202101140900570.kMeoNMKw.png",u="/assets/202101140900571.uj-hUiC2.png",m="/assets/202101140900572.lXZNPP9Y.png",E="/assets/202101140900573.QBOmB1fA.png",b="/assets/202101140900575.bAuECzZ8.png",v="/assets/202101140900577.F735cngj.png",q="/assets/202101140900579.I-5b_8Kx.png",_="/assets/202101140900581.XXXuBp3y.png",P="/assets/202101140900583.qlii1KmT.png",f="/assets/202101140900585.__0oxGX-.png",S="/assets/202101140900587.os2J-xs1.png",j="/assets/202101140900589.lsBA9RI2.png",L="/assets/202101140900591.BVGjVcj4.png",I="/assets/202101140900593.LPTwLgzx.png",x="/assets/202101140900595.19mfgMD7.png",J="/assets/202101140900597.LaHmCPti.png",K=JSON.parse('{"title":"初识 Lombok","description":"","frontmatter":{"title":"初识 Lombok","author":"查尔斯","date":"2021/01/14 09:05","categories":["工具四海谈"],"tags":["Java","Lombok"]},"headers":[],"relativePath":"categories/tools/2021/01/14/初识Lombok.md","filePath":"categories/tools/2021/01/14/初识Lombok.md","lastUpdated":1667545308000}'),N={name:"categories/tools/2021/01/14/初识Lombok.md"},w=t("h1",{id:"初识-lombok",tabindex:"-1"},[c("初识 Lombok "),t("a",{class:"header-anchor",href:"#初识-lombok","aria-label":'Permalink to "初识 Lombok"'},"")],-1),T=g(`<h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to "前言""></a></h2><p><strong>C:</strong> 在 Java 开发中,为了符合 <code>封装</code> 这一面向对象特性,在构建 JavaBean 时往往要加上 <code>getter/setter</code> 方法。</p><p>在封装的概念里,<code>getter</code> 和 <code>setter</code> 方法是我们提供给外界的统一访问入口,我们可以在其中添加合理的逻辑控制语句,来处理一些业务或解决一些不合理的赋值,非常好的特性!</p><p>但现代开发的实际使用中,我们编写的 JavaBean 的 <code>getter/setter</code> 方法体都是空的,显得非常冗余,但又不能去除。对此,我们在每次使用时,只能通过反复的心理暗示(IDE 自动生成快捷键、生成不费事儿)来麻痹自己。</p><p>Eclipse 中是 <code>Alt + Shift+S > R</code>,IntelliJ IDEA 中是 <code>[FN] + Alt+Insert > Getter and Setter</code>。</p><p>笔者相信,这些快捷键大家都很熟悉,甚至不只是它们,一般我们还会用上无参构造、带参构造、重写 <code>toString</code>、重写 <code>equals</code> 、<code>hashCode</code> 等生成快捷键,每次创建 JavaBean,写完属性之后就是一通 "火花带闪电" 快速生成,就像下面的代码一样。</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">/**</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * 宠物类</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">@author</span><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> Charles7c</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> * @date 2020-01-14</span></span>
|
@@ -1 +1 @@
|
||||
import{_ as p}from"./chunks/ArticleMetadata.EniEqKqn.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as t,a as c,R as g,b as A,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202101140900566.GRVNJqY2.jpg",C="/assets/202101140900568.6-iC6zPC.png",B="/assets/202101140900569.cq5x66L3.png",F="/assets/202101140900570.kMeoNMKw.png",u="/assets/202101140900571.uj-hUiC2.png",m="/assets/202101140900572.lXZNPP9Y.png",E="/assets/202101140900573.QBOmB1fA.png",b="/assets/202101140900575.bAuECzZ8.png",v="/assets/202101140900577.F735cngj.png",q="/assets/202101140900579.I-5b_8Kx.png",_="/assets/202101140900581.XXXuBp3y.png",P="/assets/202101140900583.qlii1KmT.png",f="/assets/202101140900585.__0oxGX-.png",S="/assets/202101140900587.os2J-xs1.png",j="/assets/202101140900589.lsBA9RI2.png",L="/assets/202101140900591.BVGjVcj4.png",I="/assets/202101140900593.LPTwLgzx.png",x="/assets/202101140900595.19mfgMD7.png",J="/assets/202101140900597.LaHmCPti.png",K=JSON.parse('{"title":"初识 Lombok","description":"","frontmatter":{"title":"初识 Lombok","author":"查尔斯","date":"2021/01/14 09:05","categories":["工具四海谈"],"tags":["Java","Lombok"]},"headers":[],"relativePath":"categories/tools/2021/01/14/初识Lombok.md","filePath":"categories/tools/2021/01/14/初识Lombok.md","lastUpdated":1667545308000}'),N={name:"categories/tools/2021/01/14/初识Lombok.md"},w=t("h1",{id:"初识-lombok",tabindex:"-1"},[c("初识 Lombok "),t("a",{class:"header-anchor",href:"#初识-lombok","aria-label":'Permalink to "初识 Lombok"'},"")],-1),T=g("",109);function R(s,O,z,G,M,V){const e=p,l=k("ClientOnly");return n(),r("div",null,[w,d(l,null,{default:o(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),A(e,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),T])}const U=h(N,[["render",R]]);export{K as __pageData,U as default};
|
||||
import{_ as p}from"./chunks/ArticleMetadata.Sb1DYAHo.js";import{_ as h,D as k,o as n,c as r,I as d,w as o,k as t,a as c,R as g,b as A,e as D}from"./chunks/framework.FVQzxbLi.js";import"./chunks/md5.RtphNWHi.js";const y="/assets/202101140900566.GRVNJqY2.jpg",C="/assets/202101140900568.6-iC6zPC.png",B="/assets/202101140900569.cq5x66L3.png",F="/assets/202101140900570.kMeoNMKw.png",u="/assets/202101140900571.uj-hUiC2.png",m="/assets/202101140900572.lXZNPP9Y.png",E="/assets/202101140900573.QBOmB1fA.png",b="/assets/202101140900575.bAuECzZ8.png",v="/assets/202101140900577.F735cngj.png",q="/assets/202101140900579.I-5b_8Kx.png",_="/assets/202101140900581.XXXuBp3y.png",P="/assets/202101140900583.qlii1KmT.png",f="/assets/202101140900585.__0oxGX-.png",S="/assets/202101140900587.os2J-xs1.png",j="/assets/202101140900589.lsBA9RI2.png",L="/assets/202101140900591.BVGjVcj4.png",I="/assets/202101140900593.LPTwLgzx.png",x="/assets/202101140900595.19mfgMD7.png",J="/assets/202101140900597.LaHmCPti.png",K=JSON.parse('{"title":"初识 Lombok","description":"","frontmatter":{"title":"初识 Lombok","author":"查尔斯","date":"2021/01/14 09:05","categories":["工具四海谈"],"tags":["Java","Lombok"]},"headers":[],"relativePath":"categories/tools/2021/01/14/初识Lombok.md","filePath":"categories/tools/2021/01/14/初识Lombok.md","lastUpdated":1667545308000}'),N={name:"categories/tools/2021/01/14/初识Lombok.md"},w=t("h1",{id:"初识-lombok",tabindex:"-1"},[c("初识 Lombok "),t("a",{class:"header-anchor",href:"#初识-lombok","aria-label":'Permalink to "初识 Lombok"'},"")],-1),T=g("",109);function R(s,O,z,G,M,V){const e=p,l=k("ClientOnly");return n(),r("div",null,[w,d(l,null,{default:o(()=>{var i,a;return[(((i=s.$frontmatter)==null?void 0:i.aside)??!0)&&(((a=s.$frontmatter)==null?void 0:a.showArticleMetadata)??!0)?(n(),A(e,{key:0,article:s.$frontmatter},null,8,["article"])):D("",!0)]}),_:1}),T])}const U=h(N,[["render",R]]);export{K as __pageData,U as default};
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user