Skip to content
Sharp

Spring Core · interview question

In a Spring Boot application, how can you inject a configuration property into a field using the @Value annotation?

Multiple choiceEasychapter-9-curatedpremiumspring-coreapplication-properties
Choose one answer
Answer and explanation

Correct answer

B. @Value("${property.name}")

Why

The @Value annotation uses the syntax ${property.name} to inject values from the application.properties file or environment variables. This allows dynamic configuration without hardcoding values.

Test yourself on Spring Core

A free test with instant, explained results. No account needed.

Start free test
All Spring Core questions →