Using an in-memory database for tests
You now have all the required knowledge to make your web service persistent. Once you have chosen a database technology, select the Play plugins you need (JDBC, JPA, and so on), configure your data sources right from your application.conf
file, use the database helper classes provided by the plugins to integrate with your database technology, and finally implement your business layer on top of your database layer.
Once you have made your business layer persistent, you probably want to run your tests to check whether you introduced a regression. However, you will unexpectedly get the following error:
[info] A Shop should [info] ! add items [error] RuntimeException: : There is no started application (Play.scala:71)
What happened? Remember that your database configuration is read by your Play application at startup and then used by your database layer. The key step is when you retrieve the data source—remember that the method takes an implicit...