springboot postgres
久しぶりにローカル環境でpostgresに接続しようとしたらエラー。
アプリはspringbootで作成。
作成の参考サイト:
途中調子に乗ってpom.xmlをeclipseの自動生成に任せて作成。
それっぽくできてたのでブラウザからDBアクセスしようとしたら
以下のエラーが発生した。
[/hello1] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause
どうも別プロジェクトのキャッシュが悪さをしている?模様。
情報サイト:
http://www.code-magagine.com/?p=2911
m2のrepository削除して再生成(maven install)してみたが、同様のエラーが発生。
別の情報サイトを発見。
情報サイト2:
情報サイト2だとpomの記述が足りない。
<dependency><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>
追加してみたけどだめ。だけど、エラーがかわった。
2020-09-01 12:45:08.032 ERROR 15040 --- [nio-8080-exec-1] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "hello1": Error resolving template [hello1], template might not exist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [hello1], template might not exist or might not be accessible by any of the configured Template Resolvers
?テンプレートが解決できないっぽいので、テンプレートのhtmlファイル名とアクセスURLの名前、サービス記載のURLパスをすべて統一してhello1に変更。
アクセスできた!
テンプレートのファイル名をきちんと合わせる必要があった模様。