tlias管理系统-参数配置化(硬编码)功能实现
This commit is contained in:
@@ -7,6 +7,7 @@ import com.aliyun.oss.common.comm.SignVersion;
|
|||||||
import com.aliyun.oss.model.PutObjectRequest;
|
import com.aliyun.oss.model.PutObjectRequest;
|
||||||
import com.aliyun.oss.model.PutObjectResult;
|
import com.aliyun.oss.model.PutObjectResult;
|
||||||
import com.aliyuncs.exceptions.ClientException;
|
import com.aliyuncs.exceptions.ClientException;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@@ -19,9 +20,16 @@ import java.util.UUID;
|
|||||||
@Component
|
@Component
|
||||||
public class AliOSSUtils {
|
public class AliOSSUtils {
|
||||||
// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。
|
// 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 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 {
|
public String upload(MultipartFile file) throws IOException, ClientException {
|
||||||
EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();
|
EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# 应用服务 WEB 访问端口
|
# 应用服务 WEB 访问端口
|
||||||
server.port=8080
|
#server.port=8080
|
||||||
#下面这些内容是为了让MyBatis映射
|
#下面这些内容是为了让MyBatis映射
|
||||||
#指定Mybatis的Mapper文件
|
#指定Mybatis的Mapper文件
|
||||||
mybatis.mapper-locations=classpath:mappers/*xml
|
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-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
|
||||||
32
tlias-web-management/src/main/resources/application.yml
Normal file
32
tlias-web-management/src/main/resources/application.yml
Normal 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
|
||||||
Reference in New Issue
Block a user