zoukankan      html  css  js  c++  java
  • Springboot----属性配置(properties和yaml)

    1.application.properties 文件

      @Value    读取 属性

    2.自定义properties文件读取:

    @PropertySource("classpath:xxx.properties") 

    @Value("${}")

    3.application.yaml文件

    @ConfigurationProperties(prefix="")

    4.@PropertySource()+@ConfigurationProperties()  properties文件可以 yml不支持 @PropertySource(没用过不知道行不行)

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-configuration-processor</artifactId>
    <version>2.2.5.RELEASE</version>
    </dependency>
  • 相关阅读:
    PS封装ES流
    win7无法删除文件夹,提示“找不到该项目”
    声明
    ZR#1005
    ZR#1004
    ZR#1009
    ZR#1008
    ZR#1015
    ZR#1012
    ZR#985
  • 原文地址:https://www.cnblogs.com/chencn/p/12369717.html
Copyright © 2011-2022 走看看