spring boot datasource configuration

Have spent quite sometime to auto apply the datasource configuration from yml, turns out it could be achieved through the



So with a configuration in yaml,

profiles: dev
auto-commit: true
connection-timeout: 30000
maximum-pool-size: 20
url: jdbc:sqlserver://..

and a bean configuration

@Bean(name = "RODataSource")
public DataSource getDataSource(){
HikariDataSource dataSource = DataSourceBuilder.create()
return dataSource;

The configurationProperties is able to reflect what’s the Bean and apply the corresponding properties.

(auto-commit, pool size and timeout value for example)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store