DEV Community

Mohammad Faisal
Mohammad Faisal

Posted on

Spring batch - changing default data-source

I had recently started learning Spring-Batch and followed the very first Getting started guide.
The default datasource used by Spring-batch is HSQL as an in-memory database, good enough for local development. But you may not only use that in production code. You can change that datasource to yours with the following configurations:

spring.datasource.url=<jdbc:url:for-your-database>
spring.datasource.username=<db-username>
spring.datasource.password=<db-password>
Enter fullscreen mode Exit fullscreen mode

All spring.datasource.* properties are bound to the fields of org.springframework.boot.autoconfigure.jdbc.DataSourceProperties class.

Top comments (0)