Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
手元の新しいPC上でSpring Bootの既存プロジェクトを起動しようとしたところ、次のようなエラーとなりプロセスが起ち上がらなくなってしまった際のメモ。
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
状況
mysql clientにてDBとの接続は可能
spring.datasource.urlはCustom DataSourceにて別途定義しているため設定ファイル上には存在しない
spring.datasource.initialization-mode=neverとしている
hikariのconnection-test-queryにはselect 1としている
推測
プロジェクトはGradleのmulti module構成となっている
Custom DataSourceの定義は共通モジュール側にて定義している
DataSourceの定義が読み込まれていない?
解決
DBは確かに存在していたが、テーブルは1つも存在しない状態だった
試しにアプリケーションで使用するテーブルをすべてCREATEしてみたところエラーは解消された
not exist的なエラーメッセージになりそうなものだが、なぜか冒頭のエラーメッセージとなった
根本的な原因究明には至らずだがひとまず調査はここまで
参考リンク