Member-only story

How to Use Profiles in Spring Boot

Gain Java Knowledge
3 min readNov 17, 2020

--

In this story we will learn how to use Profiles in Spring Boot Application.

Every enterprise application has many environments, like:

Dev | Test | Stage | Prod | UAT / Pre-Prod

Each environment requires a configurations that is specific to them. These environments host specific configurations called Profiles.

In this story I will create a simple spring boot project and will demonstrate how to setup Profiles for your Spring Boot application.

Let’s start with setting up a Spring Boot application from the https://start.spring.io/

Now Click On Generate then zip file of source code will be generated . Now we need to import this project into IDE (Eclipse).

Spring Boot Profiles Example.

In this example , we will create single rest endpoint that will load a spring property and I want to display as a Response for different profiles.

MessageController.java

I have create 3 profiles in spring boot application. We also need to follow the…

--

--

Gain Java Knowledge
Gain Java Knowledge

Written by Gain Java Knowledge

The Java programming language is one of the most popular languages today. Stay up to date with news, certifications, free learning resources and much more.

No responses yet