修改 FastDFS 的集成方式。
This commit is contained in:
@@ -1,34 +1,57 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "plusone.application.name",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.application.name'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.server.port",
|
||||
"type": "java.lang.Integer",
|
||||
"description": "A description for 'plusone.server.port'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.debug",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "A description for 'plusone.debug'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.mail.host",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.mail.host'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.mail.password",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.mail.password'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.exception.handle-all-exception",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "A description for 'plusone.exception.handle-all-exception'"
|
||||
}
|
||||
]
|
||||
}
|
||||
{"properties": [
|
||||
{
|
||||
"name": "plusone.application.name",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.application.name'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.server.port",
|
||||
"type": "java.lang.Integer",
|
||||
"description": "A description for 'plusone.server.port'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.debug",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "A description for 'plusone.debug'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.mail.host",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.mail.host'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.mail.password",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'plusone.mail.password'"
|
||||
},
|
||||
{
|
||||
"name": "plusone.exception.handle-all-exception",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "A description for 'plusone.exception.handle-all-exception'"
|
||||
},
|
||||
{
|
||||
"name": "fastdfs.http_anti_steal_token",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'fastdfs.http_anti_steal_token'"
|
||||
},
|
||||
{
|
||||
"name": "fastdfs.http_secret_key",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'fastdfs.http_secret_key'"
|
||||
},
|
||||
{
|
||||
"name": "fastdfs.http_tracker_http_port",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'fastdfs.http_tracker_http_port'"
|
||||
},
|
||||
{
|
||||
"name": "fastdfs.network_timeout_in_seconds",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'fastdfs.network_timeout_in_seconds'"
|
||||
},
|
||||
{
|
||||
"name": "fastdfs.tracker_servers",
|
||||
"type": "java.util.List",
|
||||
"description": "A description for 'fastdfs.tracker_servers'"
|
||||
}
|
||||
]}
|
||||
|
@@ -62,3 +62,17 @@ plusone:
|
||||
# 异常拦截机制是否拦截所有异常
|
||||
exception:
|
||||
handle-all-exception: false
|
||||
|
||||
fastdfs:
|
||||
connect_timeout_in_seconds: 5
|
||||
network_timeout_in_seconds: 30
|
||||
charset: UTF-8
|
||||
http_anti_steal_token: false
|
||||
http_secret_key: FastDFS1234567890
|
||||
http_tracker_http_port: 80
|
||||
tracker_servers: 10.0.11.201:22122,10.0.11.202:22122,10.0.11.203:22122
|
||||
connection_pool:
|
||||
enabled: true
|
||||
max_count_per_entry: 500
|
||||
max_idle_time: 3600
|
||||
max_wait_time_in_ms: 1000
|
||||
|
@@ -1,8 +0,0 @@
|
||||
connect_timeout = 60
|
||||
network_timeout = 60
|
||||
charset = UTF-8
|
||||
http.tracker_http_port = 8080
|
||||
http.anti_steal_token = no
|
||||
http.secret_key = 123456
|
||||
|
||||
tracker_server = 10.30.80.199:22122
|
@@ -0,0 +1,33 @@
|
||||
package xyz.zhouxy.plusone;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import xyz.zhouxy.plusone.oss.FastDFSException;
|
||||
import xyz.zhouxy.plusone.oss.FastDFSUtil;
|
||||
import xyz.zhouxy.plusone.oss.FastDFSUtil.FastDFSFile;
|
||||
|
||||
@SpringBootTest(classes = PlusoneApplication.class)
|
||||
@Slf4j
|
||||
class FastDFSTests {
|
||||
|
||||
@Resource
|
||||
FastDFSUtil fastDFSUtil;
|
||||
|
||||
@Test
|
||||
void testOSS() throws FileNotFoundException, IOException, FastDFSException {
|
||||
try (FileInputStream in = new FileInputStream("D:\\ZhouXY\\Desktop\\666.png");) {
|
||||
byte[] content = IOUtils.toByteArray(in);
|
||||
String[] upload = fastDFSUtil.upload(new FastDFSFile("666.png", content, "png"));
|
||||
log.info(String.join("/", upload));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user