forked from ityouknow/ityouknow.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
340 lines (251 loc) · 13.2 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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
<meta charset="utf-8">
<title>行之书屋</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="java,大数据,机器学习,架构,go,tidb">
<meta property="og:type" content="website">
<meta property="og:title" content="行之书屋">
<meta property="og:url" content="http://blog.aliio.net/index.html">
<meta property="og:site_name" content="行之书屋">
<meta property="og:locale" content="java,go,rust">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="行之书屋">
<link rel="alternate" href="/atom.xml" title="行之书屋" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="banner"></div>
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="/" id="logo">行之书屋</a>
</h1>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<a class="main-nav-link" href="/">Home</a>
<a class="main-nav-link" href="/archives">Archives</a>
</nav>
<nav id="sub-nav">
<a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
<a id="nav-search-btn" class="nav-icon" title="Search"></a>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit"></button><input type="hidden" name="sitesearch" value="http://blog.aliio.net"></form>
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main">
<article id="post-虚拟机架构图" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/05/17/虚拟机架构图/" class="article-date">
<time datetime="2019-05-17T09:58:45.000Z" itemprop="datePublished">2019-05-17</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/05/17/虚拟机架构图/">虚拟机脑图</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p><img src="http://assets.processon.com/chart_image/5be11339e4b067b9db571aa9.png?_=1558086172820" alt="jvm虚拟机.png"></p>
</div>
<footer class="article-footer">
<a data-url="http://blog.aliio.net/2019/05/17/虚拟机架构图/" data-id="cjvrx021l0000x4416d1ygbx1" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-spring初识" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/05/17/spring初识/" class="article-date">
<time datetime="2019-05-17T09:58:45.000Z" itemprop="datePublished">2019-05-17</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/05/17/spring初识/">spring初识</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h1 id="spring初识"><a href="#spring初识" class="headerlink" title="spring初识"></a>spring初识</h1><hr>
<p>在阅读一些框架源码时发现很多关于spring很有意思的使用方式,希望能系统的了解下spring的功能,我大体想了解以下几点:</p>
<blockquote>
<ul>
<li>bean的生命周期管理和bean容器</li>
<li>aop切面</li>
</ul>
</blockquote>
<hr>
<h2 id="bean容器"><a href="#bean容器" class="headerlink" title="bean容器"></a>bean容器</h2><ul>
<li>beanFactory,容器的简单实现,其他容器的基础;</li>
<li>上下文容器,如ApplicationContext。</li>
</ul>
<h3 id="1-上下文容器"><a href="#1-上下文容器" class="headerlink" title="1. 上下文容器"></a>1. 上下文容器</h3><ul>
<li>AnnotationConfigApplicationContext java配置类</li>
<li>AnnotationConfigWebApplicationContext java配置类加载Springweb</li>
<li>ClassPathXmlApplicationContext 类路径下XML配置</li>
<li>FileSystemApplicationContext 文件系统XMlpei</li>
<li>XmlWebApplicationContext 从web获取XMl配置</li>
</ul>
<h3 id="2-bean生命周期"><a href="#2-bean生命周期" class="headerlink" title="2. bean生命周期"></a>2. bean生命周期</h3><h2 id="bean生命周期是由beanFactory要求实现的初始化工厂需要的方法及顺序。"><a href="#bean生命周期是由beanFactory要求实现的初始化工厂需要的方法及顺序。" class="headerlink" title="bean生命周期是由beanFactory要求实现的初始化工厂需要的方法及顺序。"></a>bean生命周期是由beanFactory要求实现的初始化工厂需要的方法及顺序。</h2><p>BeanFactory注释</p>
<p>Bean factory实现应该尽可能支持标准bean生命周期接口,完整的初始化方法及其标准顺序是:</p>
<ul>
<li><ol>
<li><code>BeanNameAware.setBeanName</code></li>
</ol>
</li>
<li><ol start="2">
<li><code>BeanClassLoaderAware.setBeanClassLoader</code></li>
</ol>
</li>
<li><ol start="3">
<li><code>BeanFactoryAware.setBeanFactory</code></li>
</ol>
</li>
<li><ol start="4">
<li><code>EnvironmentAware.setEnvironment</code></li>
</ol>
</li>
<li><ol start="5">
<li>EmbeddedValueResolverAware.setEmbeddedValueResolver</li>
</ol>
</li>
<li><ol start="6">
<li>ResourceLoaderAware.setResourceLoader<br>only applicable when running in an application context)</li>
</ol>
</li>
<li><ol start="7">
<li>ApplicationEventPublisherAware.setApplicationEventPublisher<br>only applicable when running in an application context)</li>
</ol>
</li>
<li><ol start="8">
<li>MessageSourceAware.setMessageSource<br>//only applicable when running in an application context)</li>
</ol>
</li>
<li><ol start="9">
<li><code>ApplicationContextAware.setApplicationContext</code><br>only applicable when running in an application context)</li>
</ol>
</li>
<li><ol start="10">
<li>ServletContextAware.setServletContext<br>only applicable when running in a web application context)</li>
</ol>
</li>
<li><ol start="11">
<li><code>BeanPostProcessors.postProcessBeforeInitialization</code></li>
</ol>
</li>
<li><ol start="12">
<li><code>InitializingBean.afterPropertiesSet</code></li>
</ol>
</li>
<li><ol start="13">
<li><code>a custom init-method definition</code></li>
</ol>
</li>
<li><ol start="14">
<li><code>BeanPostProcessors.postProcessAfterInitialization</code></li>
</ol>
</li>
</ul>
<p>bean关闭时会调用的方法:</p>
<ul>
<li><ol>
<li><code>DestructionAwareBeanPostProcessors.postProcessBeforeDestruction</code></li>
</ol>
</li>
<li><ol start="2">
<li><code>DisposableBean.destroy</code></li>
</ol>
</li>
<li><ol start="3">
<li><code>a custom destroy-method definition</code></li>
</ol>
</li>
</ul>
<hr>
<h3 id="3-上下文配置方案"><a href="#3-上下文配置方案" class="headerlink" title="3. 上下文配置方案"></a>3. 上下文配置方案</h3><ul>
<li>XML</li>
<li>java类</li>
<li><h2 id="隐式发现机制,自动装配"><a href="#隐式发现机制,自动装配" class="headerlink" title="隐式发现机制,自动装配"></a>隐式发现机制,自动装配</h2><h2 id="2-装配Bean"><a href="#2-装配Bean" class="headerlink" title="2.装配Bean"></a>2.装配Bean</h2></li>
</ul>
<hr>
<h3 id="1-自动化装配"><a href="#1-自动化装配" class="headerlink" title="1.自动化装配"></a>1.自动化装配</h3><p>标注Bean的注解:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">- @Component 是一个泛化的概念,仅仅表示一个组件 (Bean) ,可以作用在任何层次。</span><br><span class="line">- @Named Component 替代方案</span><br><span class="line">- @Service 通常作用在业务层,但是目前该功能与 @Component 相同。</span><br><span class="line">- @Constroller 通常作用在控制层,但是目前该功能与 @Component 相同。</span><br><span class="line">- @Repository 通常作用在DAO层,但是目前该功能与 @Component 相同。</span><br></pre></td></tr></table></figure>
<p>标注Bean扫描路径方式:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">- @ComponentScan 是一个泛化的概念,仅仅表示一个组件 (Bean) ,可以作用在任何层次。</span><br><span class="line">- <context:component-scan base-package = "net.xxx"/></span><br></pre></td></tr></table></figure>
<p>注入方式:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">- @Resource 默认通过按照名称byName自动注入,也可通过type或name属性指定。</span><br><span class="line">- @Autowired 按照类型(byType)装配依赖对象</span><br><span class="line">- @Inject 同@Autowired</span><br></pre></td></tr></table></figure>
<hr>
<h3 id="2-第三方jar包类配置Bean"><a href="#2-第三方jar包类配置Bean" class="headerlink" title="2.第三方jar包类配置Bean"></a>2.第三方jar包类配置Bean</h3><ul>
<li><ol>
<li>配置类<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">@Configuration 表明该类是配置类</span><br><span class="line"></span><br><span class="line">@Bean 表明该方法返回值需要注册为bean,方法名是生成的bean名称</span><br><span class="line">带有注解的方法多次调用时返回值是单例。</span><br><span class="line">@Bean</span><br><span class="line">private A a(){,例如b,c方法中a()返回值是一样的。</span><br><span class="line">return new A();</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line">@Bean</span><br><span class="line">private B b(){</span><br><span class="line">return new B(a());</span><br><span class="line">}</span><br><span class="line">@Bean</span><br><span class="line">private C c(){</span><br><span class="line">return new C(a());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</li>
</ol>
</li>
<li><ol start="2">
<li>XML配置<br>略</li>
</ol>
</li>
</ul>
</div>
<footer class="article-footer">
<a data-url="http://blog.aliio.net/2019/05/17/spring初识/" data-id="cjvrx021q0001x441tyz39adn" class="article-share-link">Share</a>
</footer>
</div>
</article>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">Archives</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/05/">May 2019</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Recent Posts</h3>
<div class="widget">
<ul>
<li>
<a href="/2019/05/17/虚拟机架构图/">虚拟机脑图</a>
</li>
<li>
<a href="/2019/05/17/spring初识/">spring初识</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2019 aliiohse<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/" class="mobile-nav-link">Home</a>
<a href="/archives" class="mobile-nav-link">Archives</a>
</nav>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script src="/js/script.js"></script>
</div>
</body>
</html>