Performance: Profile-based configuration
This affects application startup time and memory usage by loading only relevant configuration for the active profile.
Use application-{profile}.properties files and activate profile via spring.profiles.activeapplication.properties contains all environment configs mixed together without profiles
| Pattern | Config Files Loaded | Beans Initialized | Startup Time Impact | Verdict |
|---|---|---|---|---|
| Single config with all env settings | All configs loaded | All beans for all envs | High startup delay | [X] Bad |
| Profile-based config files | Only active profile configs | Only relevant beans | Reduced startup time | [OK] Good |
dev?application.properties contains server.port=8080application-prod.properties contains server.port=9090prod, what port will the Spring Boot app run on?spring.profiles.active=dev in application.properties, but your app still uses default settings. What is the likely problem?test profile without changing application.properties. Which of these is a valid way to do it when running your Spring Boot app from the command line?java -jar app.jar --spring.profiles.active=test uses the correct Spring Boot command-line syntax. java -jar app.jar -Dspring.profiles.active=test incorrectly places the -D JVM argument after -jar; correct would be java -Dspring.profiles.active=test -jar app.jar. Flags like -profile test and --profile=test are not supported by Spring Boot.Pass the test and this pattern moves unknown