Exam 2v0-7222 All QuestionsBrowse all questions from this exam
Question 20

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

    Correct Answer: D

    @ActiveProfiles is a class-level annotation that is used to declare which bean definition profiles should be active when loading an ApplicationContext for an integration test. This aligns with its primary purpose in configuring the Spring TestContext Framework to activate specific profiles, making it the correct answer.

Discussion
james2033Option: D

'@ActiveProfiles is a class-level annotation that is used to declare which bean definition profiles should be active when loading an ApplicationContext for an integration test.' Source https://docs.spring.io/spring-framework/reference/testing/annotations/integration-spring/annotation-activeprofiles.html

2211094Option: D

The Corect answer is D. And here is why others are not correct. A: @ActiveProfiles doesn't deal with recording application events. The Spring TestContext Framework handles event publication and listening separately. B: @ActiveProfiles is specific to activating bean definition profiles for integration tests. It doesn't configure the overall bootstrapping of the TestContext Framework. C: While @ActiveProfiles indirectly affects the environment, it doesn't directly configure the locations of property files or inline properties. That's typically done through @TestPropertySource or other configuration mechanisms.