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

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

    Correct Answer: C, E

    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
james2033Options: CE

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