A Spring Boot service is deployed to multiple environments. What professional pattern ensures environment-specific beans are loaded correctly?
-
A
Hardcoding environment checks with System.getenv()
-
B
Using @Profile to activate beans based on the active Spring profile
-
C
Duplicating application code per environment
-
D
Using @Conditional with a custom always-true condition