DEV Community

loading...

Spring batch - changing default data-source

faisal6621 profile image Mohammad Faisal ・1 min read

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.

Discussion (0)

pic
Editor guide