Bird
0
0

Identify the error in this code snippet:

medium📝 Debug Q6 of 15
Spring Boot - Spring Annotations
Identify the error in this code snippet:
@Value(${app.name})
private String appName;
AField type must be int, not String
BIncorrect property name syntax
CMissing quotes around the property expression
DNo error, code is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax for @Value annotation

    The property expression must be enclosed in quotes, like @Value("${app.name}").
  2. Step 2: Identify the error

    Missing quotes cause a syntax error in Java annotations.
  3. Final Answer:

    Missing quotes around the property expression -> Option C
  4. Quick Check:

    @Value property must be quoted [OK]
Quick Trick: Always put property expressions in quotes [OK]
Common Mistakes:
  • Omitting quotes around ${property}
  • Using wrong property syntax
  • Confusing field type requirements

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes