VMware vRealize Automation 8.x (2022) — Question 15
Which statement is true about the @PropertySource annotation? (Choose the best answer.)
Answer options
- A. Used to designate the location of the application.properties file in a Spring Boot application.
- B. Used to easily look up and return a single property value from some external property file.
- C. Used to designate the file directory of the application.properties file in a Spring Boot application.
- D. Used to add a set of name/value pairs to the Spring Environment from an external source.
Correct answer: D
Explanation
The correct answer is D because the @PropertySource annotation is specifically designed to add external property files to the Spring Environment, allowing for the inclusion of additional configuration. Options A and C incorrectly imply that the annotation designates the location or directory of the application.properties file, while option B suggests it only retrieves single property values, which does not encompass its main purpose.