質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Thymeleaf

Thymeleaf(タイムリーフ)とは、Java用のテンプレートエンジンで、特定のフレームワークに依存せず使用することが可能です。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

Q&A

解決済

1回答

3518閲覧

Spring Bootでのlivereloadについて

otoko

総合スコア15

Thymeleaf

Thymeleaf(タイムリーフ)とは、Java用のテンプレートエンジンで、特定のフレームワークに依存せず使用することが可能です。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

0グッド

0クリップ

投稿2019/08/29 02:15

現在、Spring Bootでlivereloadしたいのですが、うまくいきません。状態としましては、controllerを変更した際には自動的にbuildが走るようになってますのでこちらは問題はないのですが、thymeleafの変更がブラウザに反映されませんので、困っております。恐れ入りますが、打開策をご教授いただけますと幸いです。

OS: macMojave 10.14.6
IDE: IntelliJ IDEA 2019.2.1
Chromeプラグイン: livereload

IDEでやったこと

  • Build project automaticallyのチェック
  • compiler.automake.allow.when.app.runningのチェック

build.gradle

build.gradle

1plugins { 2 id 'org.springframework.boot' version '2.1.7.RELEASE' 3 id 'io.spring.dependency-management' version '1.0.8.RELEASE' 4 id 'java' 5} 6 7version = '0.0.1-SNAPSHOT' 8sourceCompatibility = '1.8' 9 10configurations { 11 developmentOnly 12 runtimeClasspath { 13 extendsFrom developmentOnly 14 } 15} 16 17repositories { 18 mavenCentral() 19} 20 21bootRun { 22 sourceResources sourceSets.main 23 24} 25 26dependencies { 27 implementation 'org.springframework.boot:spring-boot-starter-data-jpa' 28 implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' 29 implementation 'org.springframework.boot:spring-boot-starter-web' 30 developmentOnly 'org.springframework.boot:spring-boot-devtools' 31 runtimeOnly 'mysql:mysql-connector-java' 32 testImplementation 'org.springframework.boot:spring-boot-starter-test' 33}

application.properties

spring.thymeleaf.check-template-location=true spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html spring.thymeleaf.mode=LEGACYHTML5 spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.content-type=text/html spring.thymeleaf.cache=false spring.resources.cache.period = 0 spring.devtools.restart.enabled=true

後は、chromeの検証画面のネットワークでhttp://localhost:35729/livereload.jsのstatusが200でws://localhost:35729/livereloadがstatusで101という状態です。

もうこれ以上やることがありませんので、何か打開策をご教授いただけますと幸いです。また、プラグインのlivereloadを使用しない方法でも解決策がありましたらご教授いただけますと幸いです。

以上、宜しくお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

application.propertiesを変更したら解決しました。
spring.thymeleaf.prefix=file:src/main/resources/templates/

投稿2019/08/30 04:45

otoko

総合スコア15

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問