Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Models API 1.4.2
-
None
Description
It seems that all docs for injectionStrategy in injector annotations are incorrect.
The current docs:
/** * if set to REQUIRED injection is mandatory, if set to OPTIONAL injection is optional, in case of DEFAULT * the standard annotations ({@link org.apache.sling.models.annotations.Optional}, {@link org.apache.sling.models.annotations.Required}) are used. * If even those are not available the default injection strategy defined on the {@link org.apache.sling.models.annotations.Model} applies. * Default value = DEFAULT. */
state that @Optional and @Required are used only if injectionStrategy = DEFAULT. It is not true, as these annotations take precedence over injectionStrategy.
It is confirmed by implementation of org.apache.sling.models.impl.model.AbstractInjectableElement, but also by test:
I added a new test case:
PR created: