Category: Spring Boot
Spring Boot
Spring Boot OAuth2 SSO Example with AWS Cognito
Here in this example I am going to show you how to allow users for OAuth2 SSO (Single Sign On) using AWS (Amazon Web Services) Cognito. I had explained how to do OAuth2 Single Sign On using Spring Boot and GitHub account. Here I am going to use AWS Cognito. You can use any other providers, such as, Google, Facebook,…
How to return Different Data Formats (JSON, XML) from Spring REST API
Introduction Here I am going to show you an example on how to return different data formats from REST API using Spring Boot framework. You may have a requirement that you need to return multiple formats, such as XML, JSON, etc., from the REST response, then this example may help you. This example will return XML and JSON format depending…
Mock an Autowired Value Field in Spring with Junit 5
Mock @Value In this example I am going to show you how to mock an autowired field in Spring boot framework with Junit 5. When you use @Value annotation in Spring beans to read the value from properties file and later when you want to perform Junit test then you also need to pass value for this autowired field value…
Spring Data JPA @NamedQuery and @NamedQueries Example
Introduction Spring Data JPA provides multiple ways of selecting or fetching data from database server and one of the ways is using @NamedQuery or @NamedQueries. @NamedQuery and @NamedQueries can be created using XML configuration, external properties file or using Java based annotation config. Spring Data JPA supports both JPQL and SQL native named queries. Here I am going to show…
How to generate PDF report from MySQL database in Spring Boot
I am going to show yo how to download PDF file from MySQL database using Spring Boot and iText library in Java programming language. Many applications require dynamic generation of PDF documents for reporting purpose, such as, generating statements for customers, readers buying online specific chapters of a book, etc. In my another tutorial I had shown how to create…
How to generate Excel Report from MySQL Database in Spring Boot
Here I am going to show you how to download excel file from MySQL using Spring framework. Generating excel report from MySQL database has few advantages over other file formats. Most of the people you are working with in your organization are familiar with excel file format, hence it needs a short learning curve. You may also like to read…
Docker Compose – Dockerizing Spring Boot Microservices MySQL App
Introduction Here I am going to show you how to use docker compose for dockerizing Spring Boot Microservices MySQL app. Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. You know…
How to Trace Microservices Logs with Spring Cloud Sleuth and Zipkin
Introduction Here I am going to explain how to trace Spring Boot Microservices logs with Spring Cloud Sleuth and Zipkin Server. Spring Cloud Sleuth provides Spring Boot auto-configuration for distributed tracing. One of the problems most developers face difficulty of tracing logs as your microservices applications grow and requests propagate from one microservice to another microservice. So it could be…
Create, Build, Package and Run Spring Boot Application with Docker
Build And Package With Docker Here in this tutorial I am going to show you how to create a simple Spring Boot application. Then how to build, package and run this Spring Boot application with Docker in Linux environment (CentOS). I am going to use both gradle and maven as build tools for running build on this Spring Boot application….
How include required gradle project into another project
Here I will tell you how to include the required gradle project into another project. Situation may occur when you need to have dependency of another gradle project into your current gradle project, but neither of these projects is a multi-module project. So in this case you can easily add the required project into your current working project. To include…