Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
bb6760a5
Commit
bb6760a5
authored
Jul 22, 2018
by
Menethil
Browse files
Merge remote-tracking branch 'origin/master'
parents
4b12f490
ab454046
Changes
2
Hide whitespace changes
Inline
Side-by-side
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/StorageService.java
View file @
bb6760a5
...
@@ -4,7 +4,6 @@ import org.springframework.core.io.Resource;
...
@@ -4,7 +4,6 @@ import org.springframework.core.io.Resource;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.util.Map
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
/**
/**
...
@@ -13,7 +12,6 @@ import java.util.stream.Stream;
...
@@ -13,7 +12,6 @@ import java.util.stream.Stream;
public
class
StorageService
{
public
class
StorageService
{
private
String
active
;
private
String
active
;
private
Storage
storage
;
private
Storage
storage
;
private
Map
<
String
,
Storage
>
supportedStorage
;
public
String
getActive
()
{
public
String
getActive
()
{
return
active
;
return
active
;
...
@@ -21,15 +19,14 @@ public class StorageService {
...
@@ -21,15 +19,14 @@ public class StorageService {
public
void
setActive
(
String
active
)
{
public
void
setActive
(
String
active
)
{
this
.
active
=
active
;
this
.
active
=
active
;
this
.
storage
=
this
.
supportedStorage
.
get
(
active
);
}
}
public
Map
<
String
,
Storage
>
getS
upportedS
torage
()
{
public
Storage
getStorage
()
{
return
s
upportedS
torage
;
return
storage
;
}
}
public
void
setS
upportedStorage
(
Map
<
String
,
Storage
>
s
upportedS
torage
)
{
public
void
setS
torage
(
Storage
storage
)
{
this
.
s
upportedS
torage
=
s
upportedS
torage
;
this
.
storage
=
storage
;
}
}
/**
/**
...
...
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/config/StorageAutoConfiguration.java
View file @
bb6760a5
...
@@ -22,12 +22,21 @@ public class StorageAutoConfiguration {
...
@@ -22,12 +22,21 @@ public class StorageAutoConfiguration {
public
StorageService
storageService
()
{
public
StorageService
storageService
()
{
StorageService
storageService
=
new
StorageService
();
StorageService
storageService
=
new
StorageService
();
Map
<
String
,
Storage
>
supportedStorage
=
new
HashMap
<
String
,
Storage
>(
3
);
Map
<
String
,
Storage
>
supportedStorage
=
new
HashMap
<
String
,
Storage
>(
3
);
supportedStorage
.
put
(
"local"
,
localStorage
());
supportedStorage
.
put
(
"aliyun"
,
aliyunStorage
());
supportedStorage
.
put
(
"tencent"
,
tencentStorage
());
storageService
.
setSupportedStorage
(
supportedStorage
);
String
active
=
this
.
properties
.
getActive
();
String
active
=
this
.
properties
.
getActive
();
storageService
.
setActive
(
active
);
storageService
.
setActive
(
active
);
if
(
active
.
equals
(
"local"
)){
storageService
.
setStorage
(
localStorage
());
}
else
if
(
active
.
equals
(
"aliyun"
)){
storageService
.
setStorage
(
aliyunStorage
());
}
else
if
(
active
.
equals
(
"tencent"
)){
storageService
.
setStorage
(
tencentStorage
());
}
else
{
throw
new
RuntimeException
(
"当前存储模式 "
+
active
+
" 不支持"
);
}
return
storageService
;
return
storageService
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment