zoukankan      html  css  js  c++  java
  • Spring Boot之@EnableAutoConfiguration源码解读

    @EnableAutoConfiguration:使Springboot自动配置。可以找到@SpringBootApplication所在类的包。然后将该包下的所有子包纳入spring容器。即com.doublechen.helloworld.xxx。并自动扫描。

    spring boot 在启动时,会根据meta-inf/spring.factories找到相应的第三方依赖,并将这些依赖引入本项目。

    a.自己写的代码,spring boot 通过@SpringBootConfiguration自动帮我们配置。

    b.三方依赖 通过spring-boot-autoconfiguration-2.0.3.RLEASE.jar中的META-INF/spring.factories进行声明,然后开启使用。

    c.Configuration:标识此类是一个配置类、将此类纳入springioc容器。  

    @EnableConfigurationProperties(HttpEncodingProperties.class): 通过HttpEncodingProperties将编码更改。

    @ConditionOnProperty(prefix = "spring.http.encoding",value = "enabled" match)当属性满足要求时,条件成立。

    在配置文件:application.properties中加入debug=true,可以查看那些自动装配使用,那些禁用。

    Positive matches列表 表示spring boot 自动开启了哪些装配。

    Negative matches列表 表示spring boot 在此时并没有启用的自动装配。

  • 相关阅读:
    C# winform中读取HTML代码
    C#获取参数getParameter
    C# checkboxlist的使用
    win7任务栏只显示日期不显示年月日
    做事要仔细
    JSP显示不完全问题
    C# tabconctrol切换事件
    C#中combobox不可编辑与不可选择
    根据单选框改变的文本框
    JS判断form内所有表单是否为空
  • 原文地址:https://www.cnblogs.com/jccjcc/p/14174646.html
Copyright © 2011-2022 走看看