Friday, 17 January 2020

JSON/XML/SQL and MongoDB Tutorial

Spring boot Tutorial 21 - Spring boot and layered architecture [Controller, Service and Repository layers] - Playlist

Spring boot Tutorial 21 -  Spring boot and layered architecture [Controller, Service and Repository layers] - Playlist:
https://www.youtube.com/watch?v=mp0NlY1y3vY&list=PLmCsXDGbJHdin9sHatS6Xv4VxsMEPE5kf

How to create an employee using Spring boot layered architecture and JdbcTemplate?

Different layers in spring boot application | Spring boot layered architecture

Springboot + Thymeleaf - Send user information from UI to controller | Spring Boot Tutorial

Using JdbcTemplate with Spring Boot and Thymeleaf | Spring Boot Tutorial

SpringBoot Configure DataSource Using JNDI with Example using Tomcat 9 Server

🚀 Master Advanced Spring Boot!

Join Ram N Java for professional tutorials on server configuration and Java development!

SUBSCRIBE TO THE CHANNEL

Spring Boot JNDI DataSource Configuration

In enterprise environments, managing database connections through JNDI (Java Naming and Directory Interface) is a standard practice. It allows the server to manage the connection pool, making your application more portable and secure. This guide reveals the "secrets" of setting up a JNDI DataSource in Spring Boot when deploying to Tomcat 9.

Step 1: Configure Tomcat's context.xml

The first step happens outside your application. You need to define the Resource in Tomcat's context.xml file. Here, you specify the driver class, database URL, username, password, and pooling parameters. This makes the DataSource available to any application running on the server.

Step 2: Update application.properties

Spring Boot needs to know where to look for the JNDI resource. Instead of providing database credentials in your properties file, you simply provide the JNDI name using spring.datasource.jndi-name. This keeps your application configuration clean and environment-independent.

Step 3: Creating the DataSource Bean

In your Spring configuration class, you can programmatically define the DataSource bean. By using JndiDataSourceLookup, Spring can fetch the pre-configured DataSource from the Tomcat container seamlessly during the application startup process.

Step 4: Handling the "java:comp/env" Prefix

One common pitfall is the JNDI prefix. Depending on your configuration, you might need to prepend java:comp/env/ to your resource name. Understanding how Tomcat namespaces these resources is key to a successful connection.

Step 5: Verify the Connection

Run your application on the external Tomcat server. If configured correctly, Spring Boot will successfully acquire the connection from the server's pool. You can verify this by checking your logs for the successful initialization of the Hikari or Tomcat connection pool.

Friday, 3 January 2020

JSON Tutorial - Playlist

Spring boot Tutorial 20 - Spring boot JdbcTemplate Tutorial - Playlist

Spring boot Tutorial 20 -  Spring boot JdbcTemplate Tutorial - Playlist:
https://www.youtube.com/watch?v=gxtvR-MwhIQ&list=PLmCsXDGbJHdgdwJ2YpJ977jVYJvKkPuGn

JSON Data types | JSON Tutorial

JSON Vs. XML | JSON Tutorial

JSON uses JavaScript Syntax | JSON Tutorial

JSON Syntax | JSON Tutorial

How to store/retrieve JSON data to/from the browser local storage? | JSON Tutorial

JSON Introduction | JSON Tutorial

How to use parallelSort(long[] a, int fromIndex, int toIndex) method of Java.util.Arrays Class?

How to use parallelSort(char[] a) method of Java.util.Arrays Class?

How to use parallelSort(byte[] a) method of Java.util.Arrays Class?

How to use parallelSort(short[] a) method of Java.util.Arrays Class?

How to Configure Multiple Data Sources(Databases) in a Spring Boot Application?

How to delete the record from the database using JdbcTemplate with Spring Boot? | Spring Boot

How to update the record in the database using JdbcTemplate with Spring Boot? | Spring Boot Tutorial

How to get all records from the database using JdbcTemplate with Spring Boot? | Spring Boot Tutorial

How to get a record from the database using JdbcTemplate with Spring Boot? | Spring Boot Tutorial

How to insert a record in the database using JdbcTemplate with Spring Boot? | Spring Boot Tutorial

Tutorials