Exam AD0-E123 Topic 2 Question 26 Discussion
Actual exam question for Adobe's AD0-E123 exam
Question #: 26
Topic #: 2
Question #: 26
Topic #: 2
A developer is using a Sling Model to apply some business logic to the values stored in the JCR before outputting them to the page, and all injected fields are optional for this model.
What is the proper way to apply this behavior on the class level?
What is the proper way to apply this behavior on the class level?
Suggested Answer: A Vote an answer
In Sling Models, the@DefaultInjectionStrategyannotation is used to specify the strategy for injecting fields into the model. When setting it toDefaultInjectionStrategy.OPTIONAL, it indicates that all injected fields in the Sling Model are optional and the model will not fail to instantiate if a field cannot be injected. This is a class-level annotation that affects the default injection behavior of all fields within the Sling Model.
Option B is incorrect becauserequiredInjectionStrategyis not a valid annotation property in Sling Models.
Option C is incorrect becauseinjectionStrategyis not specified at the class level; it is used on the field level with the@Injectannotation.
Option B is incorrect becauserequiredInjectionStrategyis not a valid annotation property in Sling Models.
Option C is incorrect becauseinjectionStrategyis not specified at the class level; it is used on the field level with the@Injectannotation.
by Cliff at Oct 11, 2026, 06:22 AM
0
0
0
10
Comments
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.
Report Comment
Commenting
You can sign-up / login (it's free).