spring boot jndi lookup datasource for WAS liberty - spring-boot

Hi Can any one please direct me to the example where I need to do jndi lookup for datasource in WAS liberty server. I need to do this using spring boot.

Or I don't understand your question or it is really obvious:
spring.datasource.jndi-name=DS_JNDI_NAME
You should place that to your application.properties
See the Spring Boot docs:
http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
and
http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html#boot-features-connecting-to-a-jndi-datasource

Related

Spring Boot does not support hikari keepaliveTime configuration

Can you please let us know how can I can pass keepaliveTime config to Hikari in spring boot 2.1.12
There seems to be setter called setKeepaliveTime on the DataSource objectsee docs
There is an article on how to configure datasource configurations specifically for sping boot here

Do i need c3p0 for Springboot 2.x?

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

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 to encrypt application.properties in spring boot

Spring use application.properties as the configure file, and I have created a new app which all working good exception the spring.database.password which does not meet the security requirement in my company. Is there any ways to encryt the psw? is there any example for me?
You could use jasypt to handle the encryption and then use Jasypt's Spring integration or this Jasypt Spring Boot Starter to wire it into Spring.

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