-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
263 lines (228 loc) · 34.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>霖霖的博客</title><meta name="author" content="霖霖"><meta name="copyright" content="霖霖"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta property="og:type" content="website">
<meta property="og:title" content="霖霖的博客">
<meta property="og:url" content="https://aojiaoxiaolinlin.github.io/index.html">
<meta property="og:site_name" content="霖霖的博客">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2023/05/02/a6f2b4f9a3684694824b18892588c9e3file.png">
<meta property="article:author" content="霖霖">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2023/05/02/a6f2b4f9a3684694824b18892588c9e3file.png"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://aojiaoxiaolinlin.github.io/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: undefined,
translate: undefined,
noticeOutdate: undefined,
highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
copy: {
success: '复制成功',
error: '复制错误',
noSupport: '浏览器不支持'
},
relativeDate: {
homepage: false,
post: false
},
runtime: '',
dateSuffix: {
just: '刚刚',
min: '分钟前',
hour: '小时前',
day: '天前',
month: '个月前'
},
copyright: undefined,
lightbox: 'fancybox',
Snackbar: undefined,
source: {
justifiedGallery: {
js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
}
},
isPhotoFigcaption: false,
islazyload: false,
isAnchor: false,
percent: {
toc: true,
rightside: false,
},
autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: '霖霖的博客',
isPost: false,
isHome: true,
isHighlightShrink: false,
isToc: false,
postUpdate: '2024-06-22 21:22:59'
}</script><noscript><style type="text/css">
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
#recent-posts time,
#post-meta time {
display: inline !important
}
</style></noscript><script>(win=>{
win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
if (ttl === 0) return
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},
get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()
if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
}
win.getScript = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
document.head.appendChild(script)
})
win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = url
if (id) link.id = id
link.onerror = reject
link.onload = link.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
link.onload = link.onreadystatechange = null
resolve()
}
document.head.appendChild(link)
})
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
}
}
const t = saveToLocal.get('theme')
if (t === 'dark') activateDarkMode()
else if (t === 'light') activateLightMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
}
}
const detectApple = () => {
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
})(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>const preloader = {
endLoading: () => {
document.body.style.overflow = '';
document.getElementById('loading-box').classList.add("loaded")
},
initLoading: () => {
document.body.style.overflow = 'hidden';
document.getElementById('loading-box').classList.remove("loaded")
}
}
preloader.initLoading()
window.addEventListener('load',()=> { preloader.endLoading() })
if (false) {
document.addEventListener('pjax:send', () => { preloader.initLoading() })
document.addEventListener('pjax:complete', () => { preloader.endLoading() })
}</script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2023/05/02/a6f2b4f9a3684694824b18892588c9e3file.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">13</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">5</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 链接</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/blogImages/16.jpg')"><nav id="nav"><span id="blog-info"><a href="/" title="霖霖的博客"><span class="site-name">霖霖的博客</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 链接</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">霖霖的博客</h1><div id="site_social_icons"><a class="social-icon" href="https://github.com/aojiaoxiaolinlin" target="_blank" title="'#24292e'"><i class="fab fa-github"></i></a><a class="social-icon" href="/[email protected]" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left"><a href="/2024/06/22/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F-Java/" title="设计模式-Java"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="设计模式-Java"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/06/22/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F-Java/" title="设计模式-Java">设计模式-Java</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-06-22T11:05:56.000Z" title="发表于 2024-06-22 19:05:56">2024-06-22</time></span></div><div class="content">设计原则
开闭原则:对扩展开放,对修改关闭
里氏代换原则:子类可以扩展父类的功能,但不能改变父类原有的功能。即子类应添加新的方法完成新增功能,尽量不重写父类的方法。
依赖倒转原则:高层模块依赖于抽象而不依赖于具体。对抽象编程而不对实现编程
接口隔离原则:客户端不应该被迫依赖于它不使用的方法,一个类对另一个类的依赖应该建立在最小的接口上。拆分接口。
迪米特法则:又叫最小支持原则。降低无关联类之间的耦合,使用中间类作为桥梁
合成复用原则:尽量优先使用组合或者聚合等关联关系来实现,其次才考虑使用继承关系来实现。
创建型单例模式 破坏单例的方法:
序列化:- 解决方法:使用readResolve()方法返回实例,该方法反序列化时会自动调用。
反射- 解决方法:判断是否第一次创建可以设置一个标志。
工厂模式是一种创建型设计模式,用于封装对象的创建过程。它通过定义一个创建对象的接口,但将具体对象的实例化延迟到子类或工厂类中。这样可以避免直接在客户端代码中使用 new 关键字来创建对象,从而提高代码的灵活性和可维护性。
简单工厂 由一个工厂类负责创建多个不同类型的对象。客户端通过工厂类的静态 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2024/06/22/fetch-%E8%8E%B7%E5%8F%96%E6%B5%81%E5%BC%8F%E6%95%B0%E6%8D%AE/" title="fetch 获取流式数据"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="fetch 获取流式数据"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/06/22/fetch-%E8%8E%B7%E5%8F%96%E6%B5%81%E5%BC%8F%E6%95%B0%E6%8D%AE/" title="fetch 获取流式数据">fetch 获取流式数据</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-06-22T10:11:21.000Z" title="发表于 2024-06-22 18:11:21">2024-06-22</time></span></div><div class="content">使用fetch处理流式数据,Ajax不支持流式数据12345678910111213141516171819202122fetch("http://localhost:8080/flux/dataStream2").then(res=>{ if(res.ok){ const reader = res.body.getReader(); streamParse(reader); }}).catch(error=>{ console.log(error)})function streamParse(reader){ const textDecoder = new TextDecoder(); reader.read().then(data=>{ if(data.done) return; const chunk = textDecoder.decode(data.value) ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/09/24/Quarkus%E6%A1%86%E6%9E%B6/" title="Quarkus框架"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Quarkus框架"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/09/24/Quarkus%E6%A1%86%E6%9E%B6/" title="Quarkus框架">Quarkus框架</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-09-24T07:32:11.000Z" title="发表于 2023-09-24 15:32:11">2023-09-24</time></span></div><div class="content">Quarkus学习云原生
指构建和运行应用以充分利用通过云技术交付模式交付的分布式计算。云原生应用旨在充分利用云技术平台特有的可扩展性、弹性和灵活性优势。
GraalVM(格劳尔虚拟机)是一种通用的虚拟机,它支持多种编程语言,包括Java、JavaScript、Python、Ruby、R、WebAssembly等。GraalVM的目标是提供高性能、低内存消耗的运行环境,以支持各种语言和应用的混合使用。多语言支持: GraalVM 不仅支持Java,还支持众多其他编程语言。这意味着你可以在同一个运行时环境中运行不同语言的代码,并且它们可以互相调用。
高性能: GraalVM 的即时编译器(JIT)具有出色的性能,使得它成为一种在各种应用中提供高吞吐量和低延迟的虚拟机。
原生图像构建: GraalVM 支持将Java应用程序编译成本地机器码,从而减少了启动时间和内存占用。这对于云原生和微服务应用程序特别有用。
JavaScript支持: GraalVM 包括JavaScript引擎,使得你可以在Java应用中嵌入JavaScript代码,或者使用JavaScript编写服务器端应用。
W ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/09/24/Nextjs/" title="NextJs"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="NextJs"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/09/24/Nextjs/" title="NextJs">NextJs</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-09-24T07:30:51.000Z" title="发表于 2023-09-24 15:30:51">2023-09-24</time></span></div><div class="content">nestjs各组件功能初步总结
controller===控制层
provider===服务层
Modules===功能模块
Middleware===应该类似于Servlet的过滤器a.可以修改请求与响应b.可以结束响应周期c.有类似于过滤器链的中间件链通过next()函数传递d.若没有调用next()请求会被挂起
Exception filter===将异常集中处理,同异常处理切面
Pipes===用于转换参数和验证后台接收到底参数相当于参数校验与数据转换
Guards===卫兵,类似于安全框架校验权限
Interceptors====AOP
</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/09/24/RxJs/" title="RxJs"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="RxJs"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/09/24/RxJs/" title="RxJs">RxJs</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-09-24T07:29:01.000Z" title="发表于 2023-09-24 15:29:01">2023-09-24</time></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Rxjs-typescript/">Rxjs typescript</a></span></div><div class="content">RsJs学习RxJS的核心概念包括:
Observable - 可观察对象,表示一个基于推送的异步数据流。Observer - 观察者,是一个回调函数的集合,每个回调函数对应一个 Observable 发出的值。Subscription - 订阅,表示 Observable 和 Observer之间的执行。Operators - 操作符,允许复杂的异步代码以声明式的方式进行组合。Subject - 主体,相当于 EventEmitter,用于把数据或事件多路推送给多个 Observer。Schedulers - 调度器,控制并发并管理异步任务。
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/09/24/SmallRye-Mutiny-advanced/" title="SmallRye-Mutiny(响应式编程库)高级"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="SmallRye-Mutiny(响应式编程库)高级"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/09/24/SmallRye-Mutiny-advanced/" title="SmallRye-Mutiny(响应式编程库)高级">SmallRye-Mutiny(响应式编程库)高级</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-09-24T07:26:02.000Z" title="发表于 2023-09-24 15:26:02">2023-09-24</time></span></div><div class="content">emitOn和runSubscriptionOn有什么区别?
都是将命令式转换为响应式
emitOn获取上游事件(item、completion、failure)并使用指定的executor将流重传到下游,它会影响后续操作符执行的位置(直到使用另一个emitOn操作)
runSubscriptionOn应用于订阅过程。它请求上游在指定的执行器线程上运行他的subscription(即在自己上游调用subscribe方法)
The Mutiny equivalents aremap -> onItem().transform()flatMap -> onItem().transformToUniAndMerge andonItem().transformToMultiAndMergeconcatMap -> onItem().transformToUniAndConcatenate and onItem().transformToMultiAndConcatenate
链式操作快捷方式
快捷方式
等价于
uni.map(x -> y)
uni.onIt ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/09/24/Functional-programming/" title="Java函数编程(本质为单方法接口)"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java函数编程(本质为单方法接口)"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/09/24/Functional-programming/" title="Java函数编程(本质为单方法接口)">Java函数编程(本质为单方法接口)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-09-24T07:21:16.000Z" title="发表于 2023-09-24 15:21:16">2023-09-24</time></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Java/">Java</a></span></div><div class="content">Java函数编程标准库的用法1234567//它代表一个接收参数但不返回结果的操作。消费者@FunctionalInterfacepublic interface Consumer<T> { void accept(T t);}
常见的使用场景包括:
遍历集合中的每个元素并对其执行操作
将方法引用作为Consumer传入,如File::delete
日志记录中的一些场景
接收并处理消息队列中的每个消息所以Consumer代表执行一个对参数的操作,通常用在forEach遍历或消息处理的场景中。与Supplier形成对比,Supplier生产数据,Consumer消费数据。
1234567// 代表一个没有参数只返回T类型结果的函数。生产者@FunctionalInterfacepublic interface Supplier<T> { T get();}
常用在:
需要一个提供数据的方法时
用作延迟初始化
在一些需要回调的场景下获取数据
与Stream组合生成数据
1234567//这里T表示输入参数类 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/09/24/pattern/" title="设计模式"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="设计模式"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/09/24/pattern/" title="设计模式">设计模式</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-09-24T07:16:33.000Z" title="发表于 2023-09-24 15:16:33">2023-09-24</time></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/">设计模式</a></span></div><div class="content">软件设计模式 ——Java设计原则
开闭原则:对扩展开放,对修改关闭
里氏代换原则:子类可以扩展父类的功能,但不能改变父类原有的功能。即子类应添加新的方法完成新增功能,尽量不重写父类的方法。
依赖倒转原则:高层模块依赖于抽象而不依赖于具体。对抽象编程而不对实现编程
接口隔离原则:客户端不应该被迫依赖于它不使用的方法,一个类对另一个类的依赖应该建立在最小的接口上。拆分接口。
迪米特法则:又叫最小支持原则。降低无关联类之间的耦合,使用中间类作为桥梁
合成复用原则:尽量优先使用组合或者聚合等关联关系来实现,其次才考虑使用继承关系来实现。
创建型单例模式 破坏单例的方法:
序列化:- 解决方法:使用readResolve()方法返回实例,该方法反序列化时会自动调用。
反射- 解决方法:判断是否第一次创建可以设置一个标志。
工厂模式是一种创建型设计模式,用于封装对象的创建过程。它通过定义一个创建对象的接口,但将具体对象的实例化延迟到子类或工厂类中。这样可以避免直接在客户端代码中使用 new 关键字来创建对象,从而提高代码的灵活性和可维护性。
简单工厂 由一个工厂类负责创建多个不同类型的对 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/08/03/SmallRye-Mutiny/" title="SmallRye Mutiny(响应式编程库)"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="SmallRye Mutiny(响应式编程库)"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/08/03/SmallRye-Mutiny/" title="SmallRye Mutiny(响应式编程库)">SmallRye Mutiny(响应式编程库)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-08-03T13:37:49.000Z" title="发表于 2023-08-03 21:37:49">2023-08-03</time></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E5%93%8D%E5%BA%94%E5%BC%8F%E7%BC%96%E7%A8%8B/">响应式编程</a></span></div><div class="content">java响应式编程库SmallRye Mutiny学习1234Uni.createFrom().item("hello") .onItem().transform(item -> item + " world mutiny") .onItem().transform(String::toUpperCase) .subscribe().with(item -> System.out.println("item = " + item));
与上面等价,但是不推荐,推荐链式调用
1234Uni<String> uni1 = Uni.createFrom().item("hello");Uni<String> uni2 = uni1.onItem().transform(item -> item + " mutiny");Uni<String> u ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/05/23/lin-chat-gpt/" title="lin-chat-gpt"><img class="post-bg" src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="lin-chat-gpt"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/05/23/lin-chat-gpt/" title="lin-chat-gpt">lin-chat-gpt</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-05-23T09:55:19.000Z" title="发表于 2023-05-23 17:55:19">2023-05-23</time></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Vue3-Nuxt3/">Vue3,Nuxt3</a></span></div><div class="content">Nuxt3编写在线网址
</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span><a class="page-number" href="/page/2/#content-inner">2</a><a class="extend next" rel="next" href="/page/2/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2023/05/02/a6f2b4f9a3684694824b18892588c9e3file.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">霖霖</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">13</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">5</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/aojiaoxiaolinlin"><i class="fab fa-github"></i><span>github</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/aojiaoxiaolinlin" target="_blank" title="'#24292e'"><i class="fab fa-github"></i></a><a class="social-icon" href="/[email protected]" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">我的博客</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2024/06/22/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F-Java/" title="设计模式-Java"><img src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="设计模式-Java"/></a><div class="content"><a class="title" href="/2024/06/22/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F-Java/" title="设计模式-Java">设计模式-Java</a><time datetime="2024-06-22T11:05:56.000Z" title="发表于 2024-06-22 19:05:56">2024-06-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2024/06/22/fetch-%E8%8E%B7%E5%8F%96%E6%B5%81%E5%BC%8F%E6%95%B0%E6%8D%AE/" title="fetch 获取流式数据"><img src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="fetch 获取流式数据"/></a><div class="content"><a class="title" href="/2024/06/22/fetch-%E8%8E%B7%E5%8F%96%E6%B5%81%E5%BC%8F%E6%95%B0%E6%8D%AE/" title="fetch 获取流式数据">fetch 获取流式数据</a><time datetime="2024-06-22T10:11:21.000Z" title="发表于 2024-06-22 18:11:21">2024-06-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/09/24/Quarkus%E6%A1%86%E6%9E%B6/" title="Quarkus框架"><img src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Quarkus框架"/></a><div class="content"><a class="title" href="/2023/09/24/Quarkus%E6%A1%86%E6%9E%B6/" title="Quarkus框架">Quarkus框架</a><time datetime="2023-09-24T07:32:11.000Z" title="发表于 2023-09-24 15:32:11">2023-09-24</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/09/24/Nextjs/" title="NextJs"><img src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="NextJs"/></a><div class="content"><a class="title" href="/2023/09/24/Nextjs/" title="NextJs">NextJs</a><time datetime="2023-09-24T07:30:51.000Z" title="发表于 2023-09-24 15:30:51">2023-09-24</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/09/24/RxJs/" title="RxJs"><img src="https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/2022/12/25/285a6096cb9c4f0895ac0b33dede8a559.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="RxJs"/></a><div class="content"><a class="title" href="/2023/09/24/RxJs/" title="RxJs">RxJs</a><time datetime="2023-09-24T07:29:01.000Z" title="发表于 2023-09-24 15:29:01">2023-09-24</time></div></div></div></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/Rxjs-typescript/" style="font-size: 1.1em; color: #999">Rxjs typescript</a> <a href="/tags/Vue3-Nuxt3/" style="font-size: 1.1em; color: #999">Vue3,Nuxt3</a> <a href="/tags/Java/" style="font-size: 1.5em; color: #99a9bf">Java</a> <a href="/tags/%E5%93%8D%E5%BA%94%E5%BC%8F%E7%BC%96%E7%A8%8B/" style="font-size: 1.1em; color: #999">响应式编程</a> <a href="/tags/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" style="font-size: 1.1em; color: #999">设计模式</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/06/"><span class="card-archive-list-date">六月 2024</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/09/"><span class="card-archive-list-date">九月 2023</span><span class="card-archive-list-count">6</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/08/"><span class="card-archive-list-date">八月 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/05/"><span class="card-archive-list-date">五月 2023</span><span class="card-archive-list-count">4</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">13</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2024-06-22T13:22:59.425Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://edu-lin-110.oss-cn-chengdu.aliyuncs.com/blogImages/16.jpg')"><div id="footer-wrap"><div class="copyright">©2020 - 2024 By 霖霖</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"></div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/click-heart.min.js" async="async" mobile="false"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>