Spring Certified Professional 2023 · Free Practice Question Medium

Question 17

Which class is responsible for resolving and injecting values into beans annotated with @Value?

  • A

    PropertySourceLoader

  • B

    ApplicationContext

  • C

    PropertySourcesPlaceholderConfigurer

  • D

    BeanFactory

Reveal correct answer

Correct answer: C

Explanation

The new PropertySourcesPlaceholderConfigurer added in Spring 3.1 resolve ${…} placeholders within bean definition property values and @Value annotations.

https://www.baeldung.com/properties-with-spring#usage


Springdoc:

public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport

Deprecated.as of 5.2; use org.springframework.context.support.PropertySourcesPlaceholderConfigurer instead which is more flexible through taking advantage of the Environment and PropertySource mechanisms.

PlaceholderConfigurerSupport subclass that resolves ${...} placeholders against local properties and/or system properties and environment variables.

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need