JNDI in Spring Boot Application - spring-boot

Does SpringBoot use JNDI for the data base connection (auto configuration) ?
Can you give sample use cases which requires JNDI implementation in Spring Boot Application ?

JNDI is very useful when the servlet container or the application server provides some resources to the application.
The usual example is the datasource. It is useful, because binding the datasource to the JNDI allows you to deploy the same application into different environments without changing any configuration file.

Related

Can spring boot applications deployed on a tomcat server use a common connection pooling?

When multiple spring boot applications created and deployed to a tomcat server. Is it possible to use a common connection pooling, datasource instead of providing these details in application.properties file. Or does this already taken care within the spring boot implementation
When you deploy multiple application then each application manages it connection pool.
Spring boot boundary is limited to each application context and it does not know what other application deployed and which db they are using.

How to use hornetq-configuration.xml in Spring Boot?

We have a Spring Boot application that needs to send messages to a queue available on a remote HornetQ message broker.
I saw that Spring Boot supports HornetQ in embedded mode. However, there's only a minimal set of spring.hornetq.* properties that I can set up on application.properties of my Boot application.
The application must use a core bridge (store and forward), which is configured in a hornetq-configuration.xml file.
Question: what do I need to do to make the HornetQ embedded instance provided by Spring Boot use a hornetq-configuration.xml file that I created?

spring boot jndi lookup datasource for WAS liberty

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

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

With Spring do you still need a java application server and when?

looks to me you need tomcat or some other servlet engine for the web part.
what about data access part using hibernate and jms? Thanks.
No, you don't need an application server, you can see Spring as a proprietary, modular application server implementation / adapter. But you still need an a servlet container.
Data access part: you can use hibernate and some standalone connection pool
jms: Spring is not a JMS provider, but it nicely integrates POJOs with any JMS provider
Spring also has comprehensive transactions support
Finally you have jmx and aop support built-in and easy integration with bean validation, jpa, web services, rmi, jci, task scheduling, caching...
As you can see you can either use certified application server and Java EE stack or built on top of Tomcat and pick Spring modules you need. Sometimes Spring uses standard Java EE APIs (like JPA), more often it builts its own.

Resources