This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
  • Carey Brown
  • salvin francis
  • Claude Moore

How to Populate a H2 database using SQL scripts in a specific folder  RSS feed

Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing cucumber tests in my Spring Boot project, I need to create a H2 (in-memory database) first. Then, the cucumber step definitions will use data from the database to validate if my application is working.

The problem that I am having is that the H2 database is not being created in the first place.

Here is the database section of my application.yml:

My cucumber tests are stored in src/integTest/acceptTests.

I have a couple of SQL files to create & populate the H2 database: schema.sql & data.sql. These are stored in src/integTest/resources

I think, by default Spring looks for these files in src/main/resources, but I need to somehow point them to the integTest/resources via my application.yml

Does anyone have any suggestions on what changes I need to make in order to do this?

I can post further code if it is required.

Thanks in advance for any feedback!
Those cherries would go best on cherry cheesecake. Don't put those cherries on this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!