Junior — Middle
What annotation is used in Spring to define environment profile handling?
sobes.tech AI
Answer from AI
In Spring, the @Profile annotation is used to define environment profiles. It allows activating certain beans or configurations only when a specific profile is active.
Example of usage:
@Configuration
@Profile("dev")
public class DevConfig {
// beans active only in the 'dev' profile
}
If the dev profile is active, beans from this class will be created; otherwise, they will not.