dataSource or dataSourceClassName or jdbcUrl is required
date
Aug 18, 2022
slug
dataSource-or-dataSourceClassName-or-jdbcUrl-is-required
status
Published
tags
Bugfix
MySQL
Spring Boot
DataSource
summary
type
Post
Background
I used the following programmatic
DataSource
configuration to store the datasource URL in a property file, but load the credentials programmatically.Problem
However, I recieved the error below:
What’s wrong

This error is occurring because in the
Spring Boot 2
release the default JDBC
connection pool was changed from Tomcat
to HikariCP
that ends up being faster as you can also observe in the image that I included above.This way we have one incompatibility, because
HikariCP
uses jdbc-url
instead of url
to identify the database URL
, being this the root cause of the error.Solution
To solve this problem, follow the steps below:
- In
application.properties
- In
DatasourceConfig.java