Adobe Experience Manager (AEM) AD0-E121 Practice Test

Access More Questions
In Sling Models, what does defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL mean for fields?
Correct Answer:
Injections are optional; missing values do not prevent model instantiation
Explanation:
DefaultInjectionStrategy.OPTIONAL means injections are non-mandatory. In a Sling Models class with this default, the framework will attempt to inject values for each field, but if a value can’t be found, the model still gets instantiated. The missing injection is typically left as null (or handled as empty if you use an Optional type), so your code must account for possible absence. This provides flexibility when some data sources aren’t available or optional data is fine to proceed with. If you need a specific field to be required despite the class default, you can override at the field level with an explicit injection setting to enforce a value.

Access more questions from this quiz

Continue to Adobe Experience Manager (AEM) AD0-E121 Practice Test for more practice questions and the full quiz experience.

Access More Questions