回答編集履歴
1
参考追記
answer
CHANGED
@@ -1,3 +1,44 @@
|
|
1
1
|
とりまサーブレットのファイルダウンロード処理と同じことをすれば最低限対応できます。
|
2
2
|
|
3
|
-
http://winter-tail.sakura.ne.jp/pukiwiki/index.php?Java%A4%A2%A4%EC%A4%B3%A4%EC%2FJava(Servlet)%A4%C7%A5%D5%A5%A1%A5%A4%A5%EB%A5%C0%A5%A6%A5%F3%A5%ED%A1%BC%A5%C9
|
3
|
+
http://winter-tail.sakura.ne.jp/pukiwiki/index.php?Java%A4%A2%A4%EC%A4%B3%A4%EC%2FJava(Servlet)%A4%C7%A5%D5%A5%A1%A5%A4%A5%EB%A5%C0%A5%A6%A5%F3%A5%ED%A1%BC%A5%C9
|
4
|
+
|
5
|
+
# 以下は動作確認をしてないので参考程度に
|
6
|
+
|
7
|
+
https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
|
8
|
+
|
9
|
+
```
|
10
|
+
@Override
|
11
|
+
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
12
|
+
if (!registry.hasMappingForPattern("/webjars/**")) {
|
13
|
+
registry.addResourceHandler("/webjars/**").addResourceLocations(
|
14
|
+
"classpath:/META-INF/resources/webjars/");
|
15
|
+
}
|
16
|
+
if (!registry.hasMappingForPattern("/**")) {
|
17
|
+
registry.addResourceHandler("/**").addResourceLocations(
|
18
|
+
RESOURCE_LOCATIONS);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
```
|
22
|
+
|
23
|
+
とあるので
|
24
|
+
|
25
|
+
|
26
|
+
```
|
27
|
+
@Override
|
28
|
+
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
29
|
+
if (!registry.hasMappingForPattern("/webjars/**")) {
|
30
|
+
registry.addResourceHandler("/webjars/**").addResourceLocations(
|
31
|
+
"classpath:/META-INF/resources/webjars/");
|
32
|
+
}
|
33
|
+
if (!registry.hasMappingForPattern("/upload/**")) {
|
34
|
+
registry.addResourceHandler("/upload/**").addResourceLocations(
|
35
|
+
"file:/opt/upload/");
|
36
|
+
}
|
37
|
+
if (!registry.hasMappingForPattern("/**")) {
|
38
|
+
registry.addResourceHandler("/**").addResourceLocations(
|
39
|
+
RESOURCE_LOCATIONS);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
```
|
43
|
+
|
44
|
+
のようにできるのではないでしょうか?
|