欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 金融 > Spring Boot--05--配置文件Properties

Spring Boot--05--配置文件Properties

2024/10/25 9:40:11 来源:https://blog.csdn.net/weixin_48052161/article/details/141195580  浏览:    关键词:Spring Boot--05--配置文件Properties

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

  • 配置文件Properties
    • nacos 配置


配置文件Properties

import com.alibaba.fastjson.JSON;import com.tuzhanai.cbsp.business.common.utils.JSRValidatorUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;@ConfigurationProperties(prefix = "weixin.ftp.upload")
@Configuration
@Data
@Slf4j
public class weixinProperties implements InitializingBean {@NotBlank(message = "ip must not null")private String ip;@NotNull(message = "port must not null")private Integer port;@NotBlank(message = "user must not null")private String user;@NotBlank(message = "pwd must not null")private String pwd;@NotBlank(message = "uploadDir must not null")private String uploadDir;/*** 相关文件名*//**上传的基础数据文件名: FK00006D.CAR*/@NotBlank(message = "uploadFileName must not null")private String uploadFileName;/**存储本地上传文件临时文件夹*/@NotBlank(message = "uploadLocalDir must not null")private String uploadLocalDir;private Long fizeSize;@NotBlank(message = "modelNo must not null")private String modelNo;@NotBlank(message = "page must not null")private String page;@NotBlank(message = "miniprogramState must not null")private  String miniprogramState;private Long clearday;@Overridepublic void afterPropertiesSet() throws Exception {String config = JSON.toJSONString(this);log.info("weixin文件,配置属性:{}",config);try {JSRValidatorUtil.validate(this);} catch (Exception e) {throw new IllegalArgumentException("weixin配置文件是否存在必填项为空!");}}}

nacos 配置

#weixin直接下发批量文件
weixin:ftp:upload:ip: 192.168.2.51user: tuzhanpwd: Tuzhan@2021port: 21uploadDir: /home/FTP/notice/MN00001/uploadLocalDir: /home/FTP/notice/MN00001/uploadFileName: MN00001.{0}.025.{1}.MSGfizeSize: 10000modelNo: vMYQzNt1mfEmw0-tUiYnBri_sG5vOo2csfW09pd0Laopage: pages/poster/index?taskId=miniprogramState: trialclearday: 7

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com