2v0-7222 Exam QuestionsBrowse all questions from this exam

2v0-7222 Exam - Question 73


Which two statements are correct regarding the differences between @ConfigurationProperties and @Value? (Choose two.)

Show Answer
Correct Answer: CE

ConfigurationProperties is preferable over @Value when type-safety during property binding is a concern. Additionally, @ConfigurationProperties supports relaxed binding of properties, but not property binding through SpEL. This makes @ConfigurationProperties suitable for binding externalized configuration properties to strongly-typed beans, ensuring that the loaded values conform to specific types or structures.

Discussion

1 comment
Sign in to comment
james2033Options: CE
Feb 9, 2024

See https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.external-config.typesafe-configuration-properties.vs-value-annotation https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.external-config.typesafe-configuration-properties.relaxed-binding