Do i need c3p0 for Springboot 2.x? - spring

I am migrating a existing Spring application (non Spring boot) to Springboot 2.x. I see there is a c3p0.properties file with following configuration: com.mchange.v2.c3p0.management.ExcludeIdentityToken=true. What does this does exactly? Do I need this if I am using Springboot 2.x? Or do I need to setup something else configuration in my application.properties file?
Thank you for help.

Spring Boot 2.x use HikariCp as a default JDBC connection pool. It is faster then c3p0.
You should use Hikari.
You can read about it compared with c2p0:
Hikari vs other CPs
Spring Boot will autoconfig it to you, but you can customize it (for example in application.properties)
For the com.mchange.v2.c3p0.management.ExcludeIdentityToken visit the documentation page's Jmx configuration section
JMX configuration

Related

Spring boot, spring data jpa application - how to check which connection pool being used?

How to check what is the connection pool being used by default. I am using Spring boot version 1.5.4.RELEASE
UPDATE : https://www.mkyong.com/spring-boot/spring-boot-how-to-know-which-connection-pool-is-used/
Spring Boot uses HikariCP as the default connection pool, due to its remarkable performance and enterprise-ready features.
Here’s how Spring Boot automatically configures a connection pool datasource:
Spring Boot will look for HikariCP on the classpath and use it by
default when present
If HikariCP is not found on the classpath, then Spring Boot will pick
up the Tomcat JDBC Connection Pool, if it’s available
If neither of these options is available, Spring Boot will choose
Apache Commons DBCP2, if that is available
Source: https://www.baeldung.com/spring-boot-tomcat-connection-pool

How to Refresh Spring Boot Configuration Info with Using Spring Cloud Config

I would like to ask how to refresh spring boot configuration info with using spring cloud config. Would you please give me some advice? Many thanks.
If your spring boot application is a client of Spring Cloud Configuration Server and use itself as single point of truth in the application configuration let's say retrieve application.properties/yml from the config server, you can benefit of #RefreshScope. in this case if you do a post to the /refresh if you use spring boot 1.x or /actuator/refresh if you use spring boot 2.x all the bean that are have are annotated as #RefreshScope will be refreshed.

How do I setup connection pooling in spring boot for Elasticsearch

I have created a spring boot application that uses spring boot starter data elasticsearch to connect to elasticsearch. I want to configure this application to setup connection pooling. How do I configure the application.properties to support it?
Old answer. Since Boot 2.2, the reactive client doesn't have these options.
From the docs:
spring.data.elasticsearch.properties.*= # Additional properties used to configure the client.
Though it does appear that the default TransportClient does pool connections anyway.

Consuming Spring cloud config using Spring REST service (non-boot rest service)

I'm just curious, is it possible to consume Spring Cloud config by a Spring REST service which is not a Spring boot application. If it is possible, where to define the properties in a Spring REST service. I meant, where should I define
spring.cloud.config.uri etc.
Or, only Spring boot applications are allowed to consume Cloud configuration?
Any thought would be appreciated. Thanks
well spring boot just bootstrap all configuration automatically . so for simple spring application you have to config it manually and define the cloud config server beans in your application configuration file . it could be pure old fashion xml files or just using java code configuration with #Configuration. you could find some samples in github

How to config Tomcat pooling datasource out of Spring Boot embedded one?

According to the Spring Boot Doc, we are suggested using Tomcat pooling datasource. If I want to deploy my Spring Boot application as a war file to a standard Tomcat server. How to config the pooling datasource? How to make Spring using the datasource which standard Tomcat provided?
Do a standard JNDI lookup and expose the resulting DataSource as a Bean (either via XML or Java Config).
The pooled data source can then be setup any way you like in a element in Tomcat's context.xml

Resources