Configuring a data source


MySQL database, your application.yml file:

Spring:

datasource:

url: jdbc:mysql://localhost/readinglist

username: dbuser

password: dbpass


No need to specify the JDBC driver; Spring Boot can figure it out from the database URL.

But if there is a problem, you can try setting the spring.datasource .driver-class-name property: 

driver-class-name: com.mysql.jdbc.Driver


The DataSource bean will be pooled, using Tomcat’s pooling DataSource.

it will look for and use one of these other connection

If tomcat pooling lib not available then it will look for following libs for pool implementations on the classpath:

HikariCP

Commons DBCP

Commons DBCP 2


DataSource from JNDI

spring:

datasource:

jndi-name: java:/comp/env/jdbc/readingListDS


If you set the spring.datasource.jndi-name property, the other datasource connection properties (if set) will be ignored