1 file changed
tree: 18d639fdd16936b59f12a946419d19eb11df9d5c
  1. .mvn/
  2. src/
  3. .gitignore
  4. mvnw
  5. mvnw.cmd
  6. pom.xml


Sample Application using H2 embedded database in spring boot


You should have the following installed 
 - Maven 
 - Tomcat

#Getting started

Create a sample Maven project with the following class DemoApplication

public class DemoApplication {

	// Start of a spring boot app
	public static void main(String[] args) {, args);

Add the following dependencies to your POM file


Make a sample sql statements file and give the following in the main application to run the script

// Gets the sql statements from init.sql
	private Resource initSqlScript;

	// Sql statements are executed
	public CommandLineRunner init(DataSource ds) {
		return args -> {
			ScriptUtils.executeSqlScript(ds.getConnection(), initSqlScript);

Add the model, controllers and Repositories to the code and do a maven build in eclipse or in the command prompt as follows:

mvn clean install

Run the application as spring-boot app using the following command

mvn spring-boot:run