Of these answers onky D is correct it uses SPEL but with usual value injection it should be dollar sign and curly brace, not regular parenthisis
"#{systemProperties['daily.limit']}" is correct
Option C: @Value("$(daily.limit)") is BOT CORRECT it requires "{" not "("
Correct Choices:
Option C: @Value("${daily.limit}")
Option D: @Value("#{systemProperties['daily.limit']}")
These two options correctly inject the value of the daily.limit system property.
Incorrect Choices Explanation:
Option A: @Value("#{daily.limit}")
This syntax is incorrect because it looks for a bean named daily.limit in the Spring context, not a system property.
Option B: @Value("$(systemProperties.daily.limit)")
This is incorrect because the $(...) syntax is not valid in Spring's @Value annotation.
Option E: @Value("#{systemProperties.daily.limit}")
This is incorrect because the correct SpEL syntax requires the use of ['...'] for accessing properties dynamically.
C. @Value(“$(daily.limit)”) is INCCORECT as it is using "(" parens not "{" curlies.
Im not sure if this is merely a font issue here, but it is not correct in this format. SPel uses curlies.
Correct Choices:
Option C: @Value("${daily.limit}")
Option D: @Value("#{systemProperties['daily.limit']}")
These two options correctly inject the value of the daily.limit system property.
Incorrect Choices Explanation:
Option A: @Value("#{daily.limit}")
This syntax is incorrect because it looks for a bean named daily.limit in the Spring context, not a system property.
Option B: @Value("$(systemProperties.daily.limit)")
This is incorrect because the $(...) syntax is not valid in Spring's @Value annotation.
Option E: @Value("#{systemProperties.daily.limit}")
This is incorrect because the correct SpEL syntax requires the use of ['...'] for accessing properties dynamically.
Probably, the question is incorrect. Correct way of Spring Express language like this https://docs.spring.io/spring-framework/docs/3.0.x/reference/expressions.html
value="#{ systemProperties['user.region'] }" and/or
value="#{ numberGuess.randomNumber }" and/or
@Value("#{ systemProperties['user.region'] }")
private String defaultLocale;
This question appeared on my exam. There is an error on the answers. Answer C is different than in the exam. The text in the exam is @Value(“${daily.limit}”).
I also realized this now. The way the question is formulated, B and C, has () and not {}. Only D will work. If the () in B and C were changed to {}, then C and D will be correct.
A. @Value(“#{daily.limit}”)
E. @Value(“#{systemProperties.daily.limit}”) because we are talking about SystemProperty
upvoted 4 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Uteman
1 month, 1 week agostefumies
3 months, 1 week agoEvoila_TrainingMaterial
4 months, 1 week agostefumies
1 month agoEvoila_TrainingMaterial
4 months, 1 week agojames2033
9 months, 4 weeks agoGlothan
11 months, 2 weeks agoGlothan
11 months, 2 weeks agoAzuni
1 year, 2 months agoTolo01
1 year, 4 months agoAzuni
1 year, 3 months agoqqoo
1 year, 4 months agoAzuni
1 year, 3 months agorhuanca
1 year, 8 months ago