Skip to content

Commit

Permalink
Site updated: 2019-05-23 15:23:31
Browse files Browse the repository at this point in the history
  • Loading branch information
scyx committed May 23, 2019
1 parent 5aab304 commit 59a0f7d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions 2019/05/23/Springboot自动配置原理/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<meta property="og:site_name" content="Cyx&#39;s blog">
<meta property="og:description" content="三个注解@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-05-23T07:21:22.107Z">
<meta property="og:updated_time" content="2019-05-23T07:23:11.604Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Springboot自动配置原理">
<meta name="twitter:description" content="三个注解@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan">
Expand Down Expand Up @@ -405,7 +405,7 @@ <h1 class="post-title" itemprop="name headline">Springboot自动配置原理</h1



<h2 id="三个注解-SpringBootConfiguration-EnableAutoConfiguration-ComponentScan"><a href="#三个注解-SpringBootConfiguration-EnableAutoConfiguration-ComponentScan" class="headerlink" title="三个注解@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan"></a>三个注解@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan</h2><a id="more"></a>
<h2 id="三个注解"><a href="#三个注解" class="headerlink" title="三个注解"></a>三个注解</h2><h2 id="SpringBootConfiguration-EnableAutoConfiguration-ComponentScan"><a href="#SpringBootConfiguration-EnableAutoConfiguration-ComponentScan" class="headerlink" title="@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan"></a>@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan</h2><a id="more"></a>
<p><strong>其中@SpringBootConfiguration和@ComponentScan都是原来Spring的注解,并不是Springboot新带来的注解只有@EnableAutoConfiguration是新注解,这个注解顾名思义就是开启自动配置的注解</strong><br>总结,@EnableAutoConfiguration作用<br>从classpath中搜索所有META-INF/spring.factories配置文件,然后将其中org.springframework.boot.autoconfigure.EnableAutoConfiguration key对应的配置项加载到spring容器<br>只有spring.boot.enableautoconfiguration为true(默认为true)的时候,才启用自动配置<br>@EnableAutoConfiguration还可以进行排除,排除方式有2中,一是根据class来排除(exclude),二是根据class name(excludeName)来排除<br>其内部实现的关键点有<br>1)ImportSelector 该接口的方法的返回值都会被纳入到spring容器管理中<br>2)SpringFactoriesLoader 该类可以从classpath中搜索所有META-INF/spring.factories配置文件,并读取配置</p>


Expand Down Expand Up @@ -595,7 +595,7 @@ <h2 id="三个注解-SpringBootConfiguration-EnableAutoConfiguration-ComponentSc



<div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#三个注解-SpringBootConfiguration-EnableAutoConfiguration-ComponentScan"><span class="nav-number">1.</span> <span class="nav-text">三个注解@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan</span></a></li></ol></div>
<div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#三个注解"><span class="nav-number">1.</span> <span class="nav-text">三个注解</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#SpringBootConfiguration-EnableAutoConfiguration-ComponentScan"><span class="nav-number">2.</span> <span class="nav-text">@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan</span></a></li></ol></div>


</div>
Expand Down
2 changes: 1 addition & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ pre .javascript .function {
width: 4px;
height: 4px;
border-radius: 50%;
background: #730bff;
background: #1275a6;
}
.links-of-blogroll {
font-size: 13px;
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ <h1 class="post-title" itemprop="name headline">



<h2 id="三个注解-SpringBootConfiguration-EnableAutoConfiguration-ComponentScan"><a href="#三个注解-SpringBootConfiguration-EnableAutoConfiguration-ComponentScan" class="headerlink" title="三个注解@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan"></a>三个注解@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan</h2>
<h2 id="三个注解"><a href="#三个注解" class="headerlink" title="三个注解"></a>三个注解</h2><h2 id="SpringBootConfiguration-EnableAutoConfiguration-ComponentScan"><a href="#SpringBootConfiguration-EnableAutoConfiguration-ComponentScan" class="headerlink" title="@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan"></a>@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan</h2>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2019/05/23/Springboot自动配置原理/#more" rel="contents">
Expand Down

0 comments on commit 59a0f7d

Please sign in to comment.