zoukankan      html  css  js  c++  java
  • 关与 @EnableConfigurationProperties 注解

    @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
  • 相关阅读:
    交换实验
    路由引入和控制
    ISIS
    BGP联盟
    BGP2
    bgp
    Linux日常总结
    配置本地yum源方法
    达梦数据库常见问题-安装
    达梦数据库常见问题-安装
  • 原文地址:https://www.cnblogs.com/crazy-lc/p/11801050.html
Copyright © 2011-2022 走看看