5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

# Spring Bootで、thymeleaf の変更を自動でブラウザに反映する方法

Last updated at Posted at 2020-08-16

spring bootで開発をしていて、Javaの変更はdevtools で自動的に変更が反映されるのに、HTML等の静的ファイルが自動で反映されないというとき。

application.yml(あるいはapplication.properties)に以下の設定を追加することで、変更がすぐにブラウザに反映されるようになります。

spring:
  thymeleaf:
    prefix: classpath:/templates/

もしくはこちらの書き方でも反映されます。

spring:
  thymeleaf:
    prefix: file:src/main/resources/templates/

こちらのサイトによると1つ目の書き方がデフォルトのようです。
https://spring.pleiades.io/spring-boot/docs/current/reference/html/appendix-application-properties.html

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?