Spring Boot test data population

by Will Humphreys   Last Updated February 15, 2018 14:05 PM

I have a Spring Boot application that exposes rest endpoints and stores data in a relational database.

For testing purposes I need to populate database with some test data. At what level should I write the code to populate the database. I favor using the rest endpoints to post data through my layers and into the database but this also seems a bit like overkill when I could just get a reference to the repositories and use that to insert the data. I could even just do raw SQL.

Which approach would be the most suitable and why.

Tags : rest spring


Related Questions


Project structure for Spring Boot App

Updated December 04, 2017 14:05 PM

Is it correct to use PUT with multipart content?

Updated May 25, 2016 08:02 AM