Spring Data JPA Entity Graphs

One of the important features in Spring Data JPA or simply JPA is the ability to specify fetch plans using Entity Graphs. This is useful since it allows you to customize the data, which is retrieved with a query or find operation. It is expected to display data from the same entity in different and several ways when working with…

Spring Security – JDBC Authentication

Spring JDBC Authentication In my previous tutorials, I have shown in-memory authentications Spring Security Form based Authentication – XML Configuration , Spring Security Form based Authentication – Annotations but in this tutorial I will show you how to authenticate user using Spring JDBC and Spring MVC web application to secure pages. I will create spring mvc based web application and I…

Spring @PostConstruct and @PreDestroy Example

In this tutorial I will show you how we can use @PostConstruct and @PreDestroy annotation in Spring framework. @PostConstruct and @PreDestroy annotations are generally considered best practices for receiving life cycle callbacks in a modern Spring application. Using these annotations means that our beans are not coupled to Spring specific interfaces. Sometimes we need to load some data or perform…

Define Multiple DataSources in Spring

Introduction This tutorial will show you how you can get a list of data sources using Spring framework. I will define multiple datasources in Spring. There may be situations where you need to define multiple datasources in Spring application. Why do you need multiple DataSource? You might need to connect to multiple different databases from your same application. Then you…

Batch Insert using Spring JdbcTemplate

This tutorial will show you how you can insert a large dataset or perform batch insert into a database at once using Spring JdbcTemplate. Sometimes you need to insert or update large number of records in the database. It’s not a good idea to insert multiple records into database one by one in a traditional approach. It will hit the…

Declarative Transaction Management Example in Spring

Declarative Transaction This tutorial shows an example on declarative transaction management in Spring framework. You may also want to know about Spring Transaction or Declarative Transaction management in Spring. Here I will create annotation based Spring stand alone and Spring Boot applications to create Declarative Transaction Management example in Spring framework. Here I will use H2 in-memory database to create…

Programmatic Transaction Management In Spring

Programmatic Transaction In this tutorial I will show an example on programmatic transaction management in Spring. If you want to read about Spring Transaction or Programmatic Transaction management then you can read Transaction management in Spring. Here I will show annotation based Spring stand alone application approach and Spring Boot application to create Programmatic Transaction Management example in Spring. I…