Right now, all MandatoryDocumentInitializers are executed at the same level, in a random order. However, it may be the case when one document initializer needs to be execute before or after another.
- Both the Class document and a couple of instances are mandatory documents, but the instances need to be initialized after the class and not before.
- Mandatory class document defines a StrigList property for which possible values need to be determined to a list of document, but those documents are themselves mandatory documents as well. This class can not be initialized before the mandatory document "dependencies" are initialized.
The simplest way would be to use a @Priority annotation on the components and then sorting the initializes based on this priority.
For the @Priority annotation, javax.annotation could be used which contains some general purpose annotations such as this one.
This also has the benefit that it does not influence in any way existing implementations, as thy can be considered as having all the same default priority of, say, 1000.