楽落人の備忘録

楽して生きていきたい。知識とか覚えておきたくない。

springboot postgres

久しぶりにローカル環境でpostgresに接続しようとしたらエラー。

 

アプリはspringbootで作成。

作成の参考サイト:

https://intellectual-curiosity.tokyo/2019/04/21/spring-boot%E3%81%A7%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AB%E3%82%A2%E3%82%AF%E3%82%BB%E3%82%B9%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/

 

途中調子に乗ってpom.xmleclipseの自動生成に任せて作成。

それっぽくできてたのでブラウザから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:

https://poridiet.com/2020/02/10/%E3%80%90java%E3%80%91spring%E3%81%A7%E4%BD%9C%E3%82%8Bweb%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%80%90%E3%81%9D%E3%81%AE%EF%BC%91%E3%80%91/

 

情報サイト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に変更。

 

アクセスできた!

 

テンプレートのファイル名をきちんと合わせる必要があった模様。