Spring Boot Example Make Persistent

I like to use the Spring Boot Getting started example for quick demos. How can I modify the configuration to get a persistent database? By default it uses the in-memory database. Maybe the tutorial could be updated to show both options.

Hi @charles.irvine
The easiest way to persist your data on disc is to include this line

spring.datasource.url: jdbc:h2:file:./camunda-h2-database

In your application.yaml file - replacing the datasources thats already there.
Alternatively you can startup and connect to a postgres database. Which demonstrated in this example

When I try that, I get an error. Maybe my application.yaml isn’t formatted correctly.

See below:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field transactionManager in org.camunda.bpm.spring.boot.starter.configuration.impl.DefaultDatasourceConfiguration required a bean of type 'org.springframework.transaction.PlatformTransactionManager' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.transaction.PlatformTransactionManager' in your configuration.

My application.yaml contents are:

camunda.bpm:
  admin-user:
    id: demo
    password: demo
    firstName: Demo
  filter:
    create: All tasks
spring.datasource.url: jdbc:h2:file:./camunda-h2-database

@charles.irvine Do you have the following dependency in your classpath?

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

Indentation should be 2 spaces. Also, in the .yml file it will have autocomplete feature which will take care of the indentation.

1 Like

Ok! Thanks. It is working now. I needed both the added dependency and file based jdbc url.