Both D and E are valid ways to access system properties using Spring Expression Language (SpEL). They just use different notation (array vs dot notation) to achieve the same result
Option C is False .This also uses incorrect syntax with $() instead of ${} or #{}
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.
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 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.
vance04real
5 months agofasoft
6 months agoUteman
8 months, 3 weeks agostefumies
10 months, 3 weeks ago[Removed]
11 months, 3 weeks agostefumies
8 months, 2 weeks agojames2033
1 year, 5 months agoGlothan
1 year, 6 months agoGlothan
1 year, 6 months agoAzuni
1 year, 10 months agoTolo01
1 year, 11 months agoAzuni
1 year, 10 months agoqqoo
1 year, 12 months agoAzuni
1 year, 11 months agorhuanca
2 years, 3 months ago