Search⌘ K
AI Features

Spring Boot Profiles

Explore how to define and activate Spring Boot profiles to customize application behavior for various deployment environments. Understand environment-specific configurations including server ports and properties, and learn multiple methods to activate profiles effectively for enterprise applications.

Introduction

Regardless of what enterprise application you’re developing, it will have to adapt based on the environment it’s deployed on. . The behavior of the application should change based on the environment in which it is deployed like: Dev | Test | Stage | Prod | UAT / Pre-Prod. Further one of the 12 Factor principles says “Treat backing services like DB or messaging systems as attached resources, not an integral part of our application. So that it can be attached, detached, or changed without disrupting business logic.”

Each environment requires a setting that is specific to them. For example, in DEV, we don’t really need a licensed enterprise-grade database but for UAT, Pre- prod, or prod we definitely need something like Oracle/DB2, etc. The above problem can be solved in many ways without any framework. Here,Spring Boot takes care of boilerplate code and provides box capability.

Let’s try to solve a simple problem: We want our application to run on a different ...