LoginSignup
0
0

More than 1 year has passed since last update.

`gradlew bootBuildImage`で作成したSpringBootアプリコンテナでThymeleafテンプレートがmight not existになる

Last updated at Posted at 2023-01-29

TL;DR

application.ymlからspring.thymeleaf.*系のキャッシュ設定を削除することで解決。

application.yml
spring:
-   thymeleaf:
-     cache: false # アプリリロードなしで変更を反映
-     cache-period: 0
-     prefix: file:src/main/resources/templates/

stacktrace

Error resolving template "list", template might not exist or might not be accessible by any of the configured Template Resolvers

状況

  • 任意のページにアクセスするとThymeleafエラー。テンプレートファイルがないと言われる。
  • ローカル環境ではエラーなし
  • gradlew bootBuildImageで作成したdockerイメージをコンテナ起動した場合のみエラー発生

解決策

  • cache周りが怪しかったので、application.ymlから以下を削除
application.yml
spring:
-   thymeleaf:
-     cache: false # アプリリロードなしで変更を反映
-     cache-period: 0
-     prefix: file:src/main/resources/templates/

参考:

0
0
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
0
0