@EnableConfigurationProperties注解的作用是:
  让使用 @ConfigurationProperties 注解的类生效。
  当@EnableConfigurationProperties注解应用到你的@Configuration时, 任何被@ConfigurationProperties注解的beans将自动被Environment属性配置。 这种风格的配置特别适合与SpringApplication的外部YAML配置进行配合使用。
application.yml配置文件

userbody:
name: 测试
password: 123456
birthday: 1992.10.28
mobile: 138027897343
address: 北京市西城区
实体类:

@ConfigurationProperties(prefix = "user")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {
private Long id;
private String age;
private String name;
private String password;
private String birthday;
private String mobile;
private String address;
}

Controller层上:

@EnableConfigurationProperties({User.class})
对应实体类User

关与 @EnableConfigurationProperties 注解的更多相关文章

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

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

  2. spring@value取不到值的几种情况

    一,spring组件重写构造方法,在构造方法中引用@value为null 由于spring实例化顺序为先执行构造方法,再注入成员变量,所以序为先执行构造方法,再注入成员变量,所以ing实例化顺取值为n ...

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

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

  4. 【Spring】Spring注解之@EnableConfigurationProperties

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

  5. springboot 注解@EnableConfigurationProperties @ConfigurationProperties作用

    @EnableConfigurationProperties 在springboot启动类添加,当springboot程序启动时会立即加载@EnableConfigurationProperties注 ...

  6. springboot注解

    @RestController和@RequestMapping注解 我们的Example类上使用的第一个注解是 @RestController .这被称为一个构造型(stereotype)注解.它为阅 ...

  7. springboot注解使用说明

    springboot注解 @RestController和@RequestMapping注解 我们的Example类上使用的第一个注解是 @RestController .这被称为一个构造型(ster ...

  8. SpringBoot的@Enable*注解的使用介绍

    @EnableAsync或@EnableConfigurationProperties背后的运行原理,是使用了@Import注解. @Import({User.class,Role.class,MyC ...

  9. springboot情操陶冶-@ConfigurationProperties注解解析

    承接前文springboot情操陶冶-@Configuration注解解析,本文将在前文的基础上阐述@ConfigurationProperties注解的使用 @ConfigurationProper ...

随机推荐

  1. putty 配色方案

    putty 配色方案 修改地点: Default Foreground: 255/255/255 Default Background: 51/51/51 ANSI Black: 77/77/77 A ...

  2. 8. 多态——编译时类型&运行时类型

    一.引用变量的两种类型 1. 编译时类型:由声明该变量时使用的类型决定 2. 运行时类型:由实际赋给该变量的对象决定 如果编译时类型和运行时类型不一致,就可能出现多态. class BaseClass ...

  3. 使用ghpage(github服务)搭建文档网站几种方式

    可以通过github提供的ghpage服务来搭建网站,有以下三种方式来实现: 1.文档放在master分支,作为一个子目录. 仓库:https://github.com/Ourpalm/ILRunti ...

  4. Linux文件基本命令

    Linux文件基本命令学习 操作技巧: 输入文件/目录/命令的前几个字母之后,按下tab键,则自动补全 按上/下,回滚曾经用过的命令 不想执行命令使用:crtl + c 基础命令: ls(查看) 基础 ...

  5. selenium中driver.close()和driver.quit()的不同点

    driver.quit()与driver.close()的不同:driver.quit(): Quit this driver, closing every associated windows;dr ...

  6. UVA11374 Airport Express 正反两次最短路

    问题描述 洛谷(有翻译) 吐槽 一道坑题. 如何对待商务票 因为商务票只有一张,所以在\(k\)条边中只有一条边会被选中,很显然,最后这条边会被枚举. 如何选择使用商务票的边 假设我们正在枚举这条边, ...

  7. RabbitMQ的使用(五)RabbitMQ Java Client简单生产者、消费者代码示例

    pom文件: <dependencies> <dependency> <groupId>com.rabbitmq</groupId> <artif ...

  8. WinSxS目录下文件的清除

    1)McAfee Scanner service 持续高cpu 2)上网查到了,需要看 %deflogdir%目录下的OnDemandScan_Activity.log 3) 打开这个文件,发觉一直在 ...

  9. pycharm配置docker

  10. 海边拾贝-F-第三方项目

    第三方网站,不定期更新: 陈浩个人博客: https://coolshell.cn/ 阮一峰个人博客:http://www.ruanyifeng.com/blog/2015/02/make.html ...