質問編集履歴
2
追記2
test
CHANGED
File without changes
|
test
CHANGED
@@ -303,3 +303,67 @@
|
|
303
303
|
|
304
304
|
|
305
305
|
DispatcherServletのマッピングをいじればよいようですが該当のドキュメントが見当たりません。
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
さらに追記
|
310
|
+
|
311
|
+
試したこと
|
312
|
+
|
313
|
+
WebMvcConfig.java
|
314
|
+
|
315
|
+
```java
|
316
|
+
|
317
|
+
@Configuration
|
318
|
+
|
319
|
+
public class WebMvcConfig implements WebMvcConfigurer {
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
@Override
|
324
|
+
|
325
|
+
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
|
326
|
+
|
327
|
+
configurer.enable();
|
328
|
+
|
329
|
+
}
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
@Override
|
334
|
+
|
335
|
+
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
336
|
+
|
337
|
+
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
|
338
|
+
|
339
|
+
// to serve static .html pages...
|
340
|
+
|
341
|
+
registry.addResourceHandler("/static/**").addResourceLocations("/resources/static/");
|
342
|
+
|
343
|
+
}
|
344
|
+
|
345
|
+
}
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
```
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
> DispatcherServletとデフォルトサーブレットを併用したい場合は、DispatcherServletで受けたリクエストをデフォルトサーブレットにフォワードする機能(org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler)を有効にしてください。
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
下の記事を参考に追加
|
358
|
+
|
359
|
+
[Spring MVC(+Spring Boot)上での静的リソースへのアクセスを理解する](https://qiita.com/kazuki43zoo/items/e12a72d4ac4de418ee37)
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
依然として変化なし。
|
364
|
+
|
365
|
+
CSSを反映させたいだけで激苦労。SpringBoot2、いったいどうなってるの?
|
366
|
+
|
367
|
+
一応マニュアルの該当する箇所は探したが解決法は無し。
|
368
|
+
|
369
|
+
[27.1.5 Static Content](https://docs.spring.io/spring-boot/docs/2.0.5.RELEASE/reference/htmlsingle/#boot-features-spring-mvc-static-content)
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -72,7 +72,7 @@
|
|
72
72
|
|
73
73
|
<!-- Bootstrap core CSS -->
|
74
74
|
|
75
|
-
<link href="../../dist/css/bootstrap.min.css" th:href="@{/
|
75
|
+
<link href="../../dist/css/bootstrap.min.css" th:href="@{/bootstrap/css/bootstrap.min.css}" rel="stylesheet"/>
|
76
76
|
|
77
77
|
<link th:href="@{/static/css/color.css}" rel="stylesheet"/>
|
78
78
|
|
@@ -275,3 +275,31 @@
|
|
275
275
|
そもそも静的コンテンツへのアクセスなんて大事な項目がドキュメントですぐに見つからないのはどういうことなんでしょう。
|
276
276
|
|
277
277
|
解決策のヒントがあるという方はぜひともコメントをお願いいたします!
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
追記
|
282
|
+
|
283
|
+
以下のようなエラーがでております。
|
284
|
+
|
285
|
+
> 2018-09-29 15:49:16.461 WARN 10836 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/bootstrap/css/bootstrap.min.css] in DispatcherServlet with name 'dispatcherServlet'
|
286
|
+
|
287
|
+
2018-09-29 15:49:16.463 WARN 10836 --- [nio-8080-exec-3] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/css/album.css] in DispatcherServlet with name 'dispatcherServlet'
|
288
|
+
|
289
|
+
2018-09-29 15:49:16.469 WARN 10836 --- [nio-8080-exec-3] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/bootstrap/bootstrap.min.js] in DispatcherServlet with name 'dispatcherServlet'
|
290
|
+
|
291
|
+
2018-09-29 15:49:16.471 WARN 10836 --- [nio-8080-exec-2] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/css/color.css] in DispatcherServlet with name 'dispatcherServlet'
|
292
|
+
|
293
|
+
2018-09-29 15:49:16.476 WARN 10836 --- [nio-8080-exec-4] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/js/popper.min.js] in DispatcherServlet with name 'dispatcherServlet'
|
294
|
+
|
295
|
+
2018-09-29 15:49:16.486 WARN 10836 --- [nio-8080-exec-4] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/css/album.css] in DispatcherServlet with name 'dispatcherServlet'
|
296
|
+
|
297
|
+
2018-09-29 15:49:16.922 WARN 10836 --- [nio-8080-exec-7] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/js/popper.min.js] in DispatcherServlet with name 'dispatcherServlet'
|
298
|
+
|
299
|
+
2018-09-29 15:49:16.931 WARN 10836 --- [nio-8080-exec-8] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/bootstrap/bootstrap.min.js] in DispatcherServlet with name 'dispatcherServlet'
|
300
|
+
|
301
|
+
2018-09-29 15:49:16.939 WARN 10836 --- [nio-8080-exec-9] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/bootstrap/bootstrap.min.js] in DispatcherServlet with name 'dispatcherServlet'
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
DispatcherServletのマッピングをいじればよいようですが該当のドキュメントが見当たりません。
|