@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. 修改postgresql 密码

    sudo -u postgres psql -c "alter user postgres password '123456';"

  2. awk常用命令

    1.统计TCP的连接数量,其中LISTEN多少个,ESTABLISHED多少个. [root@heiniao ~]# netstat -ant Active Internet connections ...

  3. vue操作select获取option值

    如何实时的获取你选中的值 只用@change件事 @change="changeProduct($event)" 动态传递参数 vue操作select获取option的ID值 如果 ...

  4. Vue props中Object和Array设置默认值

    Vue中,在props中设置Object和Array的默认值 seller: { type: Object, default() { return {} } } seller: { type: Obj ...

  5. HTTP 与HTTPS 简单理解

      HTTP协议,即超文本传输协议(Hypertext transfer protocol).是一种详细规定了浏览器和万维网(WWW = World Wide Web)服务器之间互相通信的规则,通过因 ...

  6. 【Spring AOP】AOP实现原理(六)

    原文链接:https://my.oschina.net/guangshan/blog/1797461

  7. BZOJ2073 「POI2004」PRZ 状压DP

    问题描述 BZOJ2073 题解 发现 \(n \le 16\) ,显然想到状压 设 \(opt[S]\) 代表过河集合为 \(S\) 时,最小时间. 枚举 \(S\) 的子集,进行转移 枚举子集的方 ...

  8. React服务器端渲染框架next.js项目实战及部署上下文context问题解决办法

    在前段时间折腾过搭建react服务器端项目架构,点击这里了解下,正好最近有个重构PC网站的需求,考虑SEO等因素.在做技术选型的时候决定采用nextjs.项目开发过程中,nextjs的体验非常棒,个人 ...

  9. python创建文件时去掉非法字符

    1.函数作用 windows系统中文件名不能包含 \ / : * ? " < > |想要创建必须过滤掉这些字符 2.函数实现 import re def filename_fil ...

  10. LeetCode 622:设计循环队列 Design Circular Queue

    LeetCode 622:设计循环队列 Design Circular Queue 首先来看看队列这种数据结构: 队列:先入先出的数据结构 在 FIFO 数据结构中,将首先处理添加到队列中的第一个元素 ...