Home > Tag Archives: spring boot

Tag Archives: spring boot

Configure Spring RestTemplate with OkHttp3 in Spring Boot Application

spring

Okhttp3 is a popular HTTP client implementation for Java and we can easily embed it in our Spring Boot RestTemplate abstraction. Below is the Bean definition which binds the instance of Okhttp3 client with RestTemplate. Now to integrate in our implementation class we just need to autowire the Resttemplate to use this customized Okhttp3 based resttemplate. How to use RestTemplate ... Read More »

Configure Spring RestTemplate with HttpClient in the Spring Boot Application

spring

In this post we will learn how to configure Spring RestTemplate with HttpClient in the Spring boot Applications. This example supports both HTTP and HTTPS. It Uses a connection-pool configurations to re-use connections and save overhead of creating connections. It has configurable request and socket timeouts, keep-alive strategy and also close idle connection strategy to monitor inactive connections and clean ... Read More »

Autowiring Components from external jars in Spring Boot Project

spring

In an Spring Boot project, sometimes we have to autowire components which are available in another jar or in another module which is added as a jar in the main module of the project. Considering the use case of my spring boot application, I created my Spring Boot project, using maven modules. One of the modules was called daolayer, one ... Read More »

Hide an End-points from Swagger Documentation in Spring Boot REST API

swagger

In this article, we will learn how to hide any end-points or entire controller for swagger documentation. While integrating Swagger with our Spring Boot REST API application we often require to hide some of the endpoints from the end-user, sometimes an entire Class of implementation is to be hidden from the end-user because these are some private types of endpoints. ... Read More »

How to document Controller and Model class using Swagger2 in Spring Boot REST project

swagger

In our article Integrate Swagger2 with Spring Boot REST API, we learned to integrate Swagger2 in our Spring Boot REST application. Here in this article, we will learn how to document the Controller and Model class of our Spring Boot project using annotations provided by Springfox Swagger 2. Controller Class Documentation To document our controller class we will use @Api, ... Read More »

Integrate Swagger2 with Spring Boot REST API

swagger

Swagger 2 makes the Spring Boot REST API much easier to describe and document. And Swagger2 is very easy to integrate with the Spring Boot application. Here we will learn this step by step and use Swagger 2 to generate Spring Boot REST API project documentation. Adding the Maven Dependencies My pom.xml, where I added the below dependencies to integrate ... Read More »

How to Disabled Swagger-UI in Production in Spring Boot Project

swagger

I have a Spring Boot REST API application and I integrated Swagger for documentation and also using it to test API with Swagger-UI. Now my task was to disable the Swagger-UI on our production environment (public domain) and enable it in our dev environment which was on private IP. APPROACH – 1 With Swagger vr-3.0.0 we can add springfox.documentation.enabled=false/true in ... Read More »