I would look at Spring's embedded database support . You can Spring create and configure a database for you and give you access to it as a simple DataSource
. All you really need to do is provide sql scripts to create / populate the database, and the database will be recreated every time it starts.
<jdbc:embedded-database id="dataSource" type="h2"> <jdbc:script location="classpath:schema.sql"/> <jdbc:script location="classpath:test-data.sql"/> </jdbc:embedded-database>
Do not forget the jdbc
namespace:
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
source share