Roshanck
Roshanck

Reputation: 2290

How to print spring datasource values in SpringBoot 2.0 application

I want to see all the default/set values for spring datasource. I am using SpringBoot 2.0.

Can someone please tell me know to print these values in a java applications.

Reason I am asking because I want to find whether the property I added to my application.yml is overwriting the default values

application.yml is as below

.
.
.
.
        spring:
          datasource:
            url: ${vcap.services.cas-db.credentials.url}
            username: ${vcap.services.cas-db.credentials.username}
            password: ${vcap.services.cas-db.credentials.password}
.
.
.
.

I have not mentioned parameters such as hikari connectionTimeout in my yml file. If want to print the values for these parameters

Upvotes: 0

Views: 4409

Answers (1)

akuma8
akuma8

Reputation: 4691

For Spring Boot 1.5 try this datasource type : org.apache.tomcat.jdbc.pool.DataSource (I'm not 100% sure). If you defined your own datasource using javax.sql.DataSource so use this one.

Since Spring Boot 2.0, default datasource is com.zaxxer.hikari.HikariDataSource.

Upvotes: 1

Related Questions