Which statement is true? (Choose the best answer.)

Which statement is true? (Choose the best answer.)
A . @ActiveProfiles is a class-level annotation that is used to instruct the Spring TestContext Framework to record all application events that are published in the ApplicationContext during the execution of a single test.
B . @ActiveProfiles is a class-level annotation that you can use to configure how the Spring TestContext Framework is bootstrapped.
C . @ActiveProfiles is a class-level annotation that you can use to configure the locations of properties files and inlined properties to be added to the set of PropertySources in the Environment for an ApplicationContext loaded for an integration test.
D . @ActiveProfiles is a class-level annotation that is used to declare which bean definition profiles should be active when loaded an ApplicationContext for an integration test.

Answer: D

Explanation:

A bean definition profile is a named logical grouping of bean definitions that can be activated or deactivated in different environments. For example, we can define different profiles for development, testing, and production environments. Spring provides the @Profile annotation to mark a bean definition or a configuration class as belonging to a specific profile. To activate a profile, we can use the spring.profiles.active property or the ConfigurableEnvironment.setActiveProfiles() method.

The @ActiveProfiles annotation is a class-level annotation that is used in conjunction with the Spring TestContext Framework to declare which profiles should be active when loading an ApplicationContext for an integration test. This annotation can be applied to any class annotated with @ContextConfiguration or a meta-annotation that is composed of @ContextConfiguration.

Reference: https://docs.spring.io/spring-framework/docs/4.2.x/spring-framework-reference/html/integration-testing.html

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments