Performance: @Profile for environment-specific beans
MEDIUM IMPACT
This concept affects application startup time and memory usage by controlling which beans load based on the environment.
@Component @Profile("dev") public class DevService { /* dev-only logic */ } @Component @Profile("prod") public class ProdService { /* prod-only logic */ }
@Component public class DevService { /* dev-only logic */ } @Component public class ProdService { /* prod-only logic */ }
| Pattern | Beans Loaded | Startup Time | Memory Usage | Verdict |
|---|---|---|---|---|
| No @Profile filtering | All beans | Higher due to extra beans | Higher memory footprint | [X] Bad |
| @Profile filtering active | Only relevant beans | Lower startup time | Lower memory footprint | [OK] Good |