問題タブ [h2db]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - Spring Boot で単体テストを実行する前に、data.sql ファイルを使用して h2 データベースにデータを挿入します。
spring boot+ JPAで単体テストを行いたい。そのために、dataSource、すべての hibernate プロパティ、entityManagerFactory、および transactionManager の Bean を作成するための構成ファイルを作成しました。すべてが完璧に進んでいます。テーブルはモデル クラスによって作成されています。しかし今、data.sqlファイルを介してテストするために、データベースのすべてのテーブルにデータを挿入したいと考えています。data.sql ファイルを src/main/resources に保存しましたが、ファイルが読み込まれません。単体テストを開始する前に、h2データベースにデータをロードするにはどうすればよいですか。
これは私の構成ファイルです -