Spring Boot Tutorial 0/110 lessons ~6 min read Lesson 50
Spring Boot Profiles
Profiles let one binary behave differently per environment.
Course progress0%
Focus
2 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
Profiles let one binary behave differently per environment. Activate with SPRING_PROFILES_ACTIVE=prod or --spring.profiles.active=prod.
Informative example
bash
# application.yml ← shared defaultsserver:port: 8080# application-dev.yml ← only when dev profile activespring:jpa:hibernate:ddl-auto: updatelogging:level:com.acme: DEBUG# application-prod.ymlspring:jpa:hibernate:ddl-auto: validatelogging:level:com.acme: INFO// Profile-scoped beans@Service@Profile("!prod")public class MockEmailSender implements EmailSender { ... }@Service@Profile("prod")public class SesEmailSender implements EmailSender { ... }
Ready to mark this lesson complete?Track your journey across the entire course.