Posted in Spring Boot Spring JPA

Spring Boot Data JPA Entity DTO Mapping Using MapStruct

Introduction In this example I will show you how to convert entity class to DTO (Data Transfer Object) class and DTO class to entity class using MapStruct. So, MapStruct will map entity class to DTO class or vice versa. This example will test both from RESTful webservices and standalone main class. Spring Boot provides CommandLineRunner interface to run the project…

Continue Reading... Spring Boot Data JPA Entity DTO Mapping Using MapStruct
Posted in RabbitMQ Spring Boot

Spring Boot RabbitMQ RPC Example

Table of Contents Introduction Callback Queue Message Properties Correlation Id Prerequisites Project Setup Application Properties Configuration Server Client Main Class Output – Testing RPC Source Code Introduction In this tutorial, I am going to show you how to create Spring Boot RabbitMQ RPC Example. RPC is an acronym which stands for Remote Procedure Call, in which a function is executed…

Continue Reading... Spring Boot RabbitMQ RPC Example
Posted in Spring Core

Spring bean life cycle call back Methods Example

Spring framework provides bean life cycle call back methods to perform some additional tasks which you may want to perform when a bean is initiated or created or when a bean is about to get destroyed. Therefore you can run a method which will do some initialization process during bean initialization and you can run another method which will do…

Continue Reading... Spring bean life cycle call back Methods Example
Posted in Spring Core

InitializingBean and DisposableBean in Spring

Spring InitializingBean and DisposableBean are the interfaces used in life cycle of Spring beans management. Each of these interfaces has only one method. InitializingBean has a method called afterPropertiesSet() and DisposableBean has a method called destroy(). Spring container runs the method afterPropertiesSet() once the bean properties have been set and Spring container runs destroy() method once Spring container releases the…

Continue Reading... InitializingBean and DisposableBean in Spring
Posted in Spring Core

Custom init() and destroy() methods in Spring

Introduction In this tutorial we will discuss on Spring custom init() and destroy() methods. These methods are call back methods which used in Spring life cycle. You can use these methods to to some initialization and clean up jobs just after the bean is created by the Spring container or just before the bean is about to be destroyed by…

Continue Reading... Custom init() and destroy() methods in Spring
Posted in Spring Boot Spring JPA

How to map Custom Query Results into DTO in Spring Data JPA

Introduction In this tutorial I will show you how to map custom query results into DTO in Spring Data JPA. Situations may occur while you are unable to return the entity object(s) as results from your Spring Data JPA Repository and instead you need to write custom query or native query for your business requirements. So in such situations you…

Continue Reading... How to map Custom Query Results into DTO in Spring Data JPA
Posted in Hibernate MySQL Spring Boot

Spring Boot MVC and Hibernate CRUD Example

Introduction In this tutorial we will create an example on Spring Boot MVC and Hibernate CRUD. CRUD is an acronym that means Create, Read, Update and Delete operations. In my other tutorial I had also created Spring Boot MVC and JDBC CRUD Example. We will build the tutorial example using both maven and gradle build tools. We will create the…

Continue Reading... Spring Boot MVC and Hibernate CRUD Example
Posted in Spring Boot Spring JDBC Spring MVC Spring Transaction

Spring Boot MVC and JDBC CRUD Example

Introduction In my other tutorial I had shown how to create an example on Spring MVC and JDBC CRUD example using annotations only, but here I am going to use Spring Boot framework. I did not update the other tutorial keeping in mind if someone still needs the example using Spring framework only. Here also I am going to show…

Continue Reading... Spring Boot MVC and JDBC CRUD Example
Posted in Spring Core Spring JDBC

How to Create Annotation based Spring Application

Introduction We will see how to create annotation based Spring application or annotation based configuration in Spring application. We will use here H2 database to perform database activities using Spring JDBC Template. We will not use any XML configuration here or zero XML configuration. We will also see how to run this stand-alone Spring application using main method. This application…

Continue Reading... How to Create Annotation based Spring Application
Posted in Spring JDBC Spring MVC

Spring MVC and JDBC CRUD with zero XML

In my other tutorials Spring MVC CRUD example with JDBC Spring MVC and Spring JDBC Example ,  Spring MVC and JDBC CRUD Example  I have used XML configurations but in this tutorial I have used only Annotation, so it means it uses zero XML configurations. This example shows how MVC(Model, View, Controller) works in Spring 4.x. In this tutorial you will also…

Continue Reading... Spring MVC and JDBC CRUD with zero XML