AD0-E123 practice question 6 of 10
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?
Full set: 50 questionsIn Sling Models, the @DefaultInjectionStrategy annotation is used to specify the strategy for injecting fields into the model. When setting it to DefaultInjectionStrategy.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 because requiredInjectionStrategy is not a valid annotation property in Sling Models.
Option C is incorrect because injectionStrategy is not specified at the class level; it is used on the field level with the @Inject annotation.
Keep practicing
Take the free AD0-E123 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other AD0-E123 practice questions
- Question 1A developer wants to be able to execute the following query: SELECT * FROM [ntbase] AS s …
- Question 2In an AEM as a Cloud Service environment, a client needs a feature to be able to explicit…
- Question 3A developer needs to extend a complete dialog from the core component, except for one tab…
- Question 4A content author will be using live copies on AEM. Which two factors must the content aut…
- Question 5A developer wants to customize a core component. Which property needs to be set in the ne…
- Question 7A developer has to enable the indexing of multiple properties asynchronously. Which type …
