Spring Boot Tutorial
Before starting spring boot, we should be very clear about spring boot that spring boot does not provides any extra feature on functionality on top of spring framework. Rather, it provides unlimited defaults configurations and useful conventions to create a stand-lone, production grade web applications in no time.It provides support for embedded tomcat, jetty, embedded database, different dev tools and many more such as metrics, health checks, useful maven defaults etc.Using these features it has really made building a production grade Spring applications very easy and faster for developers.Also, no XML configurations required anymore with spring boot.
Following are the multiple tutorials on spring boot which we will be covering and implementing in this blog.
Spring Boot Admin
By Dhiraj , 06 July, 2020 7K
In this article, we will discuss Spring Boot Admin by utilizing actuator endpoints and create separate projects for sample admin server and client with Netflix service discovery....
Spring Boot and GraphQL
By Dhiraj Ray , 10 October, 2020 3K
In this article, we will be discussing how we can implement GraphQL in Java and integrate it with a real-time Spring boot project from scratch. The project will be a maven based project....
Spring Boot + WebSocket example without STOMP and SockJs
By Dhiraj , 05 November, 2016 102K
In this post we will be discussing about Spring framework support for raw webSocket.Spring supports STOMP over WebSocket but the use of a subprotocol is not mandatory, you can deal with the raw websocket without STOMP.When using a raw websocket, the message sent lacks of information...
Spring Boot + MVC +Embedded Tomcat + Example
By Dhiraj , 29 November, 2016 33K
In this post we will be developing a sample
spring MVC app with
spring boot features using
maven. As we know, spring boot avoids all the boilerplate code and configurations that we generally do while developing a new spring project like adding build path or maven dependencies...
Spring Boot + Thymeleaf Example
By Dhiraj , 05 December, 2016 17K
Today let us discuss about what is
Thymeleaf is required and also about how to integrate
Spring Boot with a simple example.Thymeleaf is a Java XML/XHTML/HTML5 template engine that can work both in web (Servlet-based) and non-web environments. It is better suited for serving XHTML/HTML5 at the view layer of MVC-based web applications, but it can process any XML file even in offline environments....
Maintain Spring Session during WebSocket Connection
By Dhiraj , 21 December, 2016 68K
In this post, we will be discussing about how to maintain
spring session during
websockets connection through
HandshakeInterceptor.Doing so we can track user session during every websocket request and can utilize this session to track client activities from the server even after the server is connected through websocket prorocol.Now, let see by code how we can achieve it using
Spring Boot + Websocket Example
By Dhiraj , 28 January, 2017 161K
Hello friends, let us again walk through creating websocket connection with java but this time with spring and STOMP protocol.We will also make use of Spring security to restrict websocket server reply to a particular client instead of broadcasting to all clients.Here, We will be using spring boot features...
Spring Boot MVC + JSP Example
By Dhiraj , 01 February, 2017 43K
This post is about integration of spring boot mvc with jsp.Here, we will be developing a spring MVC boot app in integration with jsp using spring controller.We will also take advantage of tomcat-embed-jasper artifact of spring boot to render jsp.So let us start by defining our...
Spring Boot Actuator Tutorial
By Dhiraj , 02 July, 2020 29K
Today, we will be discussing about spring boot actuator in great details. Starting from the overview, we will deep dive into actuator concepts, configuring actuator in spring boot applications, customizing endpoints and also provide...
Spring Boot Actuator Rest Endpoints Example
By Dhiraj , 10 February, 2017 58K
In this post, we will be discussing about the different features of spring boot actuator with examples. We will be creating an example spring boot app and integrate actuator in it. The example will demonstrate the different actuator endpoints, customizing endpoints, securing endpoints and also creating custom actuator endpoints....
Spring Boot Mvc + Apache Tiles Example
By Dhiraj , 18 February, 2017 37K
This article is about spring boot mvc apache tiles integration.Here we will be creating a spring mvc app with spring boot 1.5 using apache tiles 3 layout. We will be creating different reusable page fragments such as header, body, footer using jsp and assemble them in a single jsp page at runtime using configuration file tiles.xml....
Enums as Request Parameters in Spring Boot Rest
By Dhiraj , 20 February, 2017 106K
In many enterprise application categorical variable is often required to restrict the user request. In java, we achieve it by using enums. Most of the time we define enums in model classes and expect users to provide the exact enums in the request. This also adds one level of validation in any incoming request to the server...
Spring Boot + Hibernate 5 + Mysql Example
By Dhiraj , 13 March, 2017 168K
This article is about integrating spring boot with hibernate. Here, we will be using spring boot 1.5.1 and hence by default it will be hibernate 5 configurations. We will be creating sample spring boot hibernate example having some rest endpoints exposed through spring controller. The dao class will have sessionFactory injected which will be used to create hibernate session...
Spring Data JPA Example + Spring Boot
By Dhiraj , 15 March, 2017 46K
In this tutorial we will take a look into spring data jpa in detail. We will see integratation between spring data and spring boot with examples. We will perform different crud operations using spring data and check out different ways and advantages of using it. We will have some REST endpoints exposed through spring controller and we will be invoking...
Spring Boot H2 Database Example with Hibernate
By Dhiraj , 19 March, 2017 81K
This tutorial explains about using H2 database in spring boot application with hibernate as a JPA provider. Here we will be creating a spring boot H2 database example app which will have REST endpoints exposed and perform some db operations. We will also take a look into accessing H2 db console in spring boot along with spring security integration....
Spring Boot Jms ActiveMQ Example
By Dhiraj , 13 April, 2017 147K
This article is about spring boot and JMS integration. Here we will be using spring boot features to implement asynchronous messaging service. We wil be using activemq as a message broker and look into different support provided by spring boot while integrating JMS with activemq. The application that we will be creating here will be a simple spring jms activemq example with a sample JMS producer and consumer....
Spring Boot Multiple Database Configuration Example
By Dhiraj , 24 April, 2017 109K
There are many situations where we require to fetch data from multiple databases and while using JPA sometimes it becomes challenging to create connections with multiple databases through a single application. Hence, in this article we will be discussing about creating multiple database connections with JPA using spring boot through a single application. Actually, spring boot provides a very convenient way to use multiple datasources in a single application with properties file configurations....
Spring Boot 2.0 Features
By Dhiraj , 18 May, 2017 8K
The first milestone of Spring Boot 2 has just got released this month and in this article we will point out different new features, enhancements and deprecations introduced in spring boot 2.0 along with the java version support, jetty and tomcat support, hibernate support and many more. So, let us get started....
Spring Boot Async Task Executor
By Dhiraj , 01 October, 2017 92K
In this post we will be discussing about spring asynchronous execution support using async task executor feature to execute task in a different thread. We will take a look into configuring SimpleAsyncTaskExecutor, ConcurrentTaskExecutor, ThreadPoolExecutor in a spring project. Apart from this, we will be also looking into how actual method return type can be wrapped in a Future object while dealing with async behaviour in spring....
File Upload with AngularJs And Spring Boot Rest
By Dhiraj , 02 October, 2017 40K
In this post we will be discussing about using form data to upload file to a spring boot based REST server with angular js as client.We will have a sample project having a form to upload a file and once the file is uploaded, we will be displaying the same in a table with a download button and whenever this button is clicked the image will be downloaded in the browser. We will be using spring boot to ease our development....
Spring Boot + Angular 5 +Spring Data + Rest Example(CRUD)
By Dhiraj , 05 January, 2018 429K
This article provides a complete implementation of Spring Boot, Angular 5 and spring data to build an end to end java web application with example.We will be using spring boot 1.5 to expose REST APIs and angular5 with routing to build our client that will be consuming the APIs exposed by the server.Also, we will be integrating MySql database with the backend code for CRUD operation.We will be using angular CLI to generate angular project and spring boot initializers to generate spring boot project.At the end of this article, you will be able to build a user management application with CRUD operation that can either be deployed to a standalone tomcat or deploy client and server to different servers....
4 Ways to Deploy Spring Boot Angular App(Maven + Tomcat)
By Dhiraj , 12 January, 2018 171K
In my last spring boot angular 5 article, we implemented a full stack end to end web application using spring boot angular 5.In this article we will discuss about different ways to deploy spring boot and angular app on tomcat. We will be creating a multi module maven project with backend(server) and fronted(client) and look into 4 ways about how to deploy it using maven-war-plugin, maven-resources-plugin, jar packaging etc....
Spring Boot Angular Websocket
By Dhiraj , 08 March, 2018 50K
In this tutorial, we will be discussing about creating a spring boot app to use WebSocket protocol for communication between client and server.Obviously, the server will be a spring framework based application and client will be an angular js application.Hence, this article will be integrating spring boot web socket app with an angular application and the communication between these two applications will be over WebSocket protocol.The angular version used here is Angular 5....
Spring JMS Solace Example
By Dhiraj , 16 October, 2018 18K
In this article, we will be creating a sample Spring JMS Solace Example that will consume messages from a Solace Messaging queue and topic. For easy setup of our application, we will be using spring boot and all the configurations will be java based following JMS specifications. We will be creating a sample JMS listener that will consume messages from the Solace Messaging queue....
Different Ways to Create Spring Boot SOAP Client
By Dhiraj , 26 February, 2019 61K
This article is about consuming SOAP web services through a Spring Boot app. We will be creating a sample spring boot SOAP client to consume SOAP web services using the maven plugins. We will be demonstrating the client generation process using 2 different maven plugins - maven-jaxb2-plugin and cxf-codegen-plugin. Once, the stubs are generated, we will be using WebServiceTemplate to marshal our request and response....
Spring Boot JPA Hibernate Login Example
By Dhiraj , 10 March, 2019 26K
In this article, we will be creating a sample spring boot and hibernate JPA example and add the functionality of user registration and login. This example can be a starting point to get started with a full-fledged spring boot and hibernate app. The registration process will create an entry in the database and during the sign-in process, the user credentials will be validated from DB....
Spring Boot Redis Cache
By Dhiraj , 29 June, 2019 91K
In this tutorial, we will be discussing the integration of Redis cache with Spring Boot by developing a CRUD operation example using Jedis and spring boot starter data redis. In the tutorial, we will explore 2 different ways to perform CRUD operations. First, we will be defining our custom RedisTemplate and use HashOperations to perform get and put operations on Redis server. Next, we will be using @Cacheable annotation to enable implicit caching mechanism by Spring Boot and upon cache miss, the lookup will be done in the DB with spring boot starter data jpa....
Spring Boot MongoDB Configuration
By Dhiraj , 03 July, 2019 110K
In this quick article, we will deal with spring boot mongo DB configuration. Spring Boot provides similar repository implementation as JPARepository for Mongo DB as well which is called MongoRepository. Hence, spring boot makes easier to access Mongo DB from a java application....
Spring Boot MongoDB CRUD Example
By Dhiraj , 06 July, 2019 96K
In this tutorial, we will learn to integrate MongoDB with a spring boot application and perform different CRUD operations through Spring Data MongoRepository as well as MongoTemplate with different examples and samples. The different CRUD operations such as Create, Read, Update and Delete will be first implemented through MongoRepository and the same operations will be again implemented in MongoTemplate to provide the implementation differences between both the approaches. Also, we will have the REST endpoints exposed to perform these operations. Hence, we are going to develop an end to end spring boot MongoDB example app to perform different CRUD operations....
Spring WebFlux Reactive REST API
By Dhiraj , 08 July, 2019 46K
In this article, we will learn about Spring WebFlux - reactive programming support for Web applications in Spring Framework 5 which is built on a Reactive Streams API to run on non-blocking servers. We will create a sample app that exposes reactive REST APIs for different CRUD operations such as Create, Read, Update and Delete using annotated controllers. We will be using spring data MongoDB reactive API available in ReactiveMongoRepository for different DB operations of our user entity....
Spring Boot + Angular 8 +Spring Data + Rest Example(CRUD)
By Dhiraj , 10 July, 2019 49K
In this article, we will develop a full stack app using Spring Boot and Angular 8 which performs different CRUD operations on a User entity. We will have spring data integrated at the DAO layer that performs different DB operations. We will be using MySQL database to save the user details. The REST APIs will have a token-based authentication integrated with Spring Security. At the client side, Angular routes will be protected and we will have Angular interceptors to add the token in every HTTP request....
Spring Data MongoDB Queries
By Dhiraj , 15 July, 2019 115K
In this article, we will learn about Spring data MongoDB queries with different ways to create and execute MongoDB queries in a spring boot project. We will learn to create various custom dynamic queries with multiple MongoDB operators to get started. For this, we will have a spring boot MongoDB application setup and create sample examples of all our learnings....
Uploading and Downloading Files with Spring Boot
By Dhiraj , 19 August, 2019 128K
In this tutorial, we will learn different ways with which we can upload and download files such as pdf, .zip file or images with spring boot and REST. The implementation will have examples to upload and download single and multiple files. While uploading, we will have choices to either save the uploaded file in the local file system with Resource provided in Spring framework or save it to the database....
Spring Boot RabbitMQ Example
By Dhiraj , 07 September, 2019 47K
RabbitMQ is a widely used AMQP broker. In this article, we will learn how to integrate RabbitMQ with Spring Boot and develop a message producer and consumer example app with RabbitMQ and spring boot. We will be building a simple notification system and we will be testing the app with CommandLineRunner. The producer will publish the message to the direct exchange with routing key and the consumer consumes this message asynchronously....
How to make use of Spring Boot for Microservices, Docker and Kubernetes
By Sravan Cynixit , 05 May, 2020 5K
This article gives you an overview of building a few micro services using a spring boot, docker and then deploy them into Kubernetes....