Which statement is true about the @PropertySource annotation? (Choose the best answer.)
Suggested Answer: D
Get Premium 2V0-72.22 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
This is true because the @PropertySource annotation provides a convenient and declarative mechanism for adding a PropertySource to Spring's Environment. A PropertySource is an abstraction for a source of name/value pairs that can be used by the Environment to resolve properties. The @PropertySource annotation can be used to load properties from an external file, such as a .properties or .yml file, and make them available to the application context.
https://docs.spring.io/spring-framework/reference/core/beans/environment.html#beans-using-propertysource
12 comments · newest first
NO
Noah
2 months ago
I agree with D. It’s about integrating external properties effectively.
JE
Jerilyn
2 months ago
I feel like A is misleading. It’s not just about the location.
JE
Jennifer
2 months ago
I think option D is the best choice. It adds properties to the Spring Environment.
CH
Charlette
2 months ago
D sounds interesting too, but I think A is the best answer here.
EL
Elizabeth
2 months ago
Wait, is it really just for the application.properties? Seems too limited.
RO
Roxanne
2 months ago
I thought it was B at first, but A is definitely right.
TA
Tamra
3 months ago
Totally agree with A! Makes sense.
DU
Dudley
3 months ago
A is correct, it points to the properties file.
CO
Colene
3 months ago
I thought @PropertySource was mainly for designating file locations, but now I'm confused about whether that's A or C.
LE
Leonor
3 months ago
I feel like option D sounds right, but I can't recall if it specifically mentions external sources.
CE
Cecilia
3 months ago
I remember practicing a question about Spring annotations, and I think @PropertySource is used to add properties to the Spring Environment.
GL
Glory
4 months ago
I think @PropertySource is related to loading properties, but I'm not sure if it's specifically for application.properties or other files too.