|
@@ -7,6 +7,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
@@ -22,7 +23,7 @@ import java.text.SimpleDateFormat;
|
|
|
@Component
|
|
|
public class MiniOUtils {
|
|
|
|
|
|
-
|
|
|
+
|
|
|
private static final String ip = "https://ldb-airport.hz-hanghui.com:9100/img/";
|
|
|
|
|
|
|
|
@@ -123,8 +124,17 @@ public class MiniOUtils {
|
|
|
.object(fileName)
|
|
|
.stream(inputStream, Long.valueOf(inputStream.available()), -1l)
|
|
|
.contentType(contentType).build());
|
|
|
+ inputStream.close();
|
|
|
} catch (Exception e) {
|
|
|
new RuntimeException("上传发生错误!");
|
|
|
+ } finally {
|
|
|
+ if (inputStream != null) {
|
|
|
+ try {
|
|
|
+ inputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return ip + bucketName + "/" + fileName;
|
|
|
}
|