diff --git a/tlias-web-management/src/main/java/com/inmind/utils/AliOSSUtils.java b/tlias-web-management/src/main/java/com/inmind/utils/AliOSSUtils.java index 84b49ea..463b43d 100644 --- a/tlias-web-management/src/main/java/com/inmind/utils/AliOSSUtils.java +++ b/tlias-web-management/src/main/java/com/inmind/utils/AliOSSUtils.java @@ -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(); diff --git a/tlias-web-management/src/main/resources/application.properties b/tlias-web-management/src/main/resources/application.properties index d0427e3..bc76bb7 100644 --- a/tlias-web-management/src/main/resources/application.properties +++ b/tlias-web-management/src/main/resources/application.properties @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/tlias-web-management/src/main/resources/application.yml b/tlias-web-management/src/main/resources/application.yml new file mode 100644 index 0000000..3ddc67b --- /dev/null +++ b/tlias-web-management/src/main/resources/application.yml @@ -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