application-base.yml
app:# 附件存储路径upload-attachments: /data/attachments/# 报告导出详情 url - 前端score-detail-url: ${app.host.web}/#/process/start?processNo={}# api 文件下载 urlfile-download-url: ${app.host.web}/prod-api/sys_file_info/download/{}?fullfilename={}# kkfile 文件预览 urlfile-preview-url: ${app.host.web}/preview/onlinePreview?url={}
application-test.yml
app:host:# 前端 hostweb: http://10.10.10.11:5174
import cn.hutool.core.io.FileUtil;
import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;/*** 功能描述** @author jason*/
@Data
@Configuration
@ConfigurationProperties(prefix = "app")
public class AppConfig implements InitializingBean {/*** 附件路径*/private String uploadAttachments;/*** 报告详情点击 url*/private String scoreDetailUrl;/*** 文件下载 url*/private String fileDownloadUrl;/*** kkfileview 文件预览 url*/private String filePreviewUrl;/*** host*/private Host host;/*** 方便直接获取*/public static AppConfig INSTANCE;@Overridepublic void afterPropertiesSet() {INSTANCE = this;// 自动创建文件夹FileUtil.mkdir(uploadAttachments);}@Datapublic static class Host {private String web;private String api;private String file;}}