tlias管理系统-参数配置化(硬编码)功能实现

This commit is contained in:
2025-10-13 14:33:38 +08:00
parent c5541c22d4
commit 29f56e563c
3 changed files with 49 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import com.aliyun.oss.common.comm.SignVersion;
import com.aliyun.oss.model.PutObjectRequest;
import com.aliyun.oss.model.PutObjectResult;
import com.aliyuncs.exceptions.ClientException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
@@ -19,9 +20,16 @@ import java.util.UUID;
@Component
public class AliOSSUtils {
// Endpoint以华东1杭州为例其它Region请按实际情况填写。
private String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
/*private String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
private String bucketName = "inmind-test1";
private String region = "cn-hangzhou";
private String region = "cn-hangzhou";*/
@Value("${aliyun.oss.endpoint}")
private String endpoint;
@Value("${aliyun.oss.bucketName}")
private String bucketName;
@Value("${aliyun.oss.region}")
private String region ;
public String upload(MultipartFile file) throws IOException, ClientException {
EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();

View File

@@ -1,5 +1,5 @@
# 应用服务 WEB 访问端口
server.port=8080
#server.port=8080
#下面这些内容是为了让MyBatis映射
#指定Mybatis的Mapper文件
mybatis.mapper-locations=classpath:mappers/*xml
@@ -23,4 +23,9 @@ mybatis.configuration.map-underscore-to-camel-case=true
#文件上传大小配置
spring.servlet.multipart.max-file-size= 10MB
spring.servlet.multipart.max-request-size=100MB
spring.servlet.multipart.max-request-size=100MB
#阿里云OSS配置信息
aliyun.oss.endpoint=https://oss-cn-hangzhou.aliyuncs.com
aliyun.oss.bucketName=inmind-test1
aliyun.oss.region=cn-hangzhou

View File

@@ -0,0 +1,32 @@
server:
port: 8080
#定义对象
user:
name: zhangsan
age: 18
password: 123456
#定义map集合
userMap:
name: zhangsan
age: 18
password: 123456
#定义数组/list/set
hobbys:
- 吃饭
- 睡觉
- 玩手机
#定义对象数组 User[] 定义User对象的list
users:
- name: lisi
age: 20
gender: 1
- name: wangwu
age: 21
gender: 2
- name: zhaoliu
age: 22
gender: 1