参考:https://www.jianshu.com/p/7f54da1cb2eb

使用 @ConfigurationProperties 注解的类生效。

如果一个配置类只配置@ConfigurationProperties注解,而没有使用@Component,那么在IOC容器中是获取不到properties 配置文件转化的bean。
==> @EnableConfigurationProperties 相当于把使用 @ConfigurationProperties 的类进行了一次注入。
@ConfigurationProperties 与 @EnableConfigurationProperties 的关系:
  
@EnableConfigurationProperties :     
  1. /**
    * Enable support for {@link ConfigurationProperties} annotated beans.
    * {@link ConfigurationProperties} beans can be registered in the standard way (for
    * example using {@link Bean @Bean} methods) or, for convenience, can be specified
    * directly on this annotation.
    *
    * @author Dave Syer
    */
@EnableConfigurationProperties注解应用到你的@Configuration时, 任何被@ConfigurationProperties注解的beans将自动被Environment属性配置。 这种风格的配置特别适合与SpringApplication的外部YAML配置进行配合使用。
  1.  @EnableConfigurationProperties=@ConfigurationProperties+@Component

@EnableConfigurationProperties的更多相关文章

  1. @ConfigurationProperties + @EnableConfigurationProperties

    1.ConfigurationProperties 在类上通过@ConfigurationProperties注解声明当前类为属性读取类. 举例: @ConfigurationProperties(p ...

  2. 在Spring Boot中使用 @ConfigurationProperties 注解, @EnableConfigurationProperties

    但 Spring Boot 提供了另一种方式 ,能够根据类型校验和管理application中的bean. 这里会介绍如何使用@ConfigurationProperties.继续使用mail做例子. ...

  3. @EnableConfigurationProperties、@EnableAsync、 @EnableTransactionManagement

    ★@ConfigurationProperties和@EnableConfigurationProperties配合使用 @ConfigurationProperties注解主要用来把properti ...

  4. @Import @bean,@Conditional @ConfigurationProperties @EnableConfigurationProperties 注解使用

    一分钟学会spring注解之@Import注解http://blog.51cto.com/4247649/2118354 @Autowired与@Resource 注解的使用 https://www. ...

  5. springboot @ConfigurationProperties @EnableConfigurationProperties @Bean @ Component

    https://www.cnblogs.com/duanxz/p/4520571.html https://juejin.im/post/5cbeaa26e51d45789024d7e2 1. Bea ...

  6. @ConfigurationProperties和@EnableConfigurationProperties配合使用

    https://blog.csdn.net/u010502101/article/details/78758330 @ConfigurationProperties注解主要用来把properties配 ...

  7. Spring Boot 外部化配置(二) - @ConfigurationProperties 、@EnableConfigurationProperties

    目录 3.外部化配置的核心 3.2 @ConfigurationProperties 3.2.1 注册 Properties 配置类 3.2.2 绑定配置属性 3.1.3 ConfigurationP ...

  8. 关与 @EnableConfigurationProperties 注解

    @EnableConfigurationProperties注解的作用是: 让使用 @ConfigurationProperties 注解的类生效. 当@EnableConfigurationProp ...

  9. 【Spring】Spring注解之@EnableConfigurationProperties

    一.@EnableConfigurationProperties注解的作用 使能够对@ConfigurationProperties注解的bean的支持.   简单理解就是:可以在我们的配置类上不加@ ...

随机推荐

  1. react 中的 setState

    语法:setState(newState [,callback]) 1.只要有入门基础的同学都知道 setState({...}) 是更新组件中的 state 内容 2.但是,setState 是异步 ...

  2. Restful WebService简介

    RESTful Web Services已经渐渐開始流行, 主要是用于解决异构系统之间的通信问题.非常多站点和应用提供的API,都是基于RESTful风格的Web Services,比較就有Googl ...

  3. Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] C C Problem about Polyline 数学

                                                                           C. A Problem about Polyline   ...

  4. 通过shell脚本批处理es数据

    #!/bin/sh [按照指定的域名-website集合,遍历各个域名,处理url] #指定待删除的变量集合 arr=(6.0) cur="`date +%Y%m%d%H%M%S`" ...

  5. XMU 1125 越野车大赛 【三分】

    1125: 越野车大赛 Time Limit: 500 MS  Memory Limit: 64 MB  Special JudgeSubmit: 8  Solved: 4[Submit][Statu ...

  6. vue 目录结构介绍

    1 初始目录如下: 2 目录结构介绍 bulid:最终帆布的代码存放位置 config:配置目录,包括端口号等 node_modules:npm加载的项目依赖模块 src:z这里是我们要开发的目录,基 ...

  7. Kettle 连接 oracle 报错:could not be found, make sure the 'Oracle' driver (jar file) is installed.

    我的ETL版本为6.0 oracle版本为11.2.0 报错如下: Driver class 'oracle.jdbc.driver.OracleDriver' could not be found, ...

  8. bzoj 1725: [Usaco2006 Nov]Corn Fields牧场的安排【状压dp】

    压一维状态,转移时把符合条件的上一行加上 #include<iostream> #include<cstdio> using namespace std; const int ...

  9. python orm / 表与model相互转换

    orm英文全称object relational mapping,就是对象映射关系程序,简单来说我们类似python这种面向对象的程序来说一切皆对象,但是我们使用的数据库却都是关系型的,为了保证一致的 ...

  10. Asp.Net 开发实战技术

    1.什么是WMI技术 WMI是一项核心的Windows管理技术,WMI作为一种规范和基础结构,通过它可以访问.配置.管理和监视几乎所有的Windows资源,比如用户可以在远程计算机器上启动一个进程:设 ...