beginnerSpring Core Annotations

What does the @Value annotation do in Spring?

@Value injects a single configuration value — from application.properties/yml, an environment variable, or a system property — directly into a field or constructor parameter, e.g. @Value("${server.port}") private int port. It also supports SpEL (Spring Expression Language) for computed values and can specify a default with @Value("${some.key:defaultValue}") if the property is missing.

This is a Pro question

Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.

What does the @Value annotation do in Spring?

Next Step

Continue to Redis is down. Should your application also go down? How would you design the fallback?← Back to all Spring Boot & Microservices questions