Swiftorial Logo
Home
Swift Lessons
Tutorials
Learn More
Career
Resources

Spring Boot FAQ: Top Questions

19. How do profiles work in Spring Boot?

Spring Boot allows multiple configurations for different environments using the concept of profiles. You can define environment-specific properties using application-{profile}.properties.

🗺️ Steps:

  1. Create profile-specific files (e.g., application-dev.properties).
  2. Activate profile via spring.profiles.active=dev.

🏆 Expected Output:

Loads settings from dev configuration during startup.

🛠️ Use Cases:

  • Separation of dev, test, and prod configs.
  • Switching environments via command line or environment variables.