回答編集履歴

1

参考追記

2018/04/14 04:10

投稿

退会済みユーザー
test CHANGED
@@ -3,3 +3,85 @@
3
3
 
4
4
 
5
5
  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
6
+
7
+
8
+
9
+ # 以下は動作確認をしてないので参考程度に
10
+
11
+
12
+
13
+ https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
14
+
15
+
16
+
17
+ ```
18
+
19
+ @Override
20
+
21
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
22
+
23
+ if (!registry.hasMappingForPattern("/webjars/**")) {
24
+
25
+ registry.addResourceHandler("/webjars/**").addResourceLocations(
26
+
27
+ "classpath:/META-INF/resources/webjars/");
28
+
29
+ }
30
+
31
+ if (!registry.hasMappingForPattern("/**")) {
32
+
33
+ registry.addResourceHandler("/**").addResourceLocations(
34
+
35
+ RESOURCE_LOCATIONS);
36
+
37
+ }
38
+
39
+ }
40
+
41
+ ```
42
+
43
+
44
+
45
+ とあるので
46
+
47
+
48
+
49
+
50
+
51
+ ```
52
+
53
+ @Override
54
+
55
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
56
+
57
+ if (!registry.hasMappingForPattern("/webjars/**")) {
58
+
59
+ registry.addResourceHandler("/webjars/**").addResourceLocations(
60
+
61
+ "classpath:/META-INF/resources/webjars/");
62
+
63
+ }
64
+
65
+ if (!registry.hasMappingForPattern("/upload/**")) {
66
+
67
+ registry.addResourceHandler("/upload/**").addResourceLocations(
68
+
69
+ "file:/opt/upload/");
70
+
71
+ }
72
+
73
+ if (!registry.hasMappingForPattern("/**")) {
74
+
75
+ registry.addResourceHandler("/**").addResourceLocations(
76
+
77
+ RESOURCE_LOCATIONS);
78
+
79
+ }
80
+
81
+ }
82
+
83
+ ```
84
+
85
+
86
+
87
+ のようにできるのではないでしょうか?