zoukankan      html  css  js  c++  java
  • SpringBoot 配置文件提示功能

    https://www.cnblogs.com/lw5946/p/11769298.html

    1.项目中引入依耐

    <!-- 引入相关依赖 -->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-configuration-processor</artifactId>
    <optional>true</optional>
    </dependency>
    <!--lombok-->
    <dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    </dependency>

    2.添加配置文件

    import lombok.Data;
    import org.springframework.boot.context.properties.ConfigurationProperties;
    import org.springframework.context.annotation.Configuration;
    
    @Configuration
    @ConfigurationProperties(prefix = "file.upload")
    @Data
    public class FileUploadConfig {
    
        /** Maximum number of bytes per file */
        private String maxSize = "1024M";
    
        /** 不允许的文件后缀 */
        private String rejectSuffix;
    }
    

      

    import lombok.Data;
    import org.springframework.boot.context.properties.ConfigurationProperties;
    import org.springframework.context.annotation.Configuration;
    
    import java.util.Map;
    
    
    @Configuration
    @ConfigurationProperties("map.test")
    @Data
    public class MapTestConfig {
        /** 测试Map类型数据的提示 */
        private Map<String, Object> data;
    
    }
    

    3.把项目 maven compile

      

  • 相关阅读:
    真的要努力了
    实事求是
    要努力了
    新征程,新目标
    真的要放弃了吗
    集中力量 主攻文科
    May the force be with me.
    记录级排名
    Android开发过程中git、repo、adb、grep等指令的使用
    Ubuntu环境变量设置
  • 原文地址:https://www.cnblogs.com/418836844qqcom/p/11770882.html
Copyright © 2011-2022 走看看