How will dependency Injection/Annotation scanning work?

Peter Kriens peter.kriens at aqute.biz
Mon Oct 5 12:54:02 UTC 2015


It could of course also be stored in the class file format since it is extensible. However, in all those use cases it is not compiled by the java compiler but by (something like) the jar tool.

Looking at the state of the design of this aspect I guess this will not make it in Java 9?

Kind regards,

	Peter Kriens





> On 30 sep. 2015, at 16:02, Paul Benedict <pbenedict at apache.org> wrote:
> 
> If the module-info was not in binary format, it could be possible to list the annotations in the module meta data. This is just another reason to make the "module-info" an open format. A build tool could easily do this index (like Maven) at packaging time.
> 
> 
> Cheers,
> Paul
> 
> On Wed, Sep 30, 2015 at 2:33 AM, Peter Kriens <peter.kriens at aqute.biz <mailto:peter.kriens at aqute.biz>> wrote:
> Thanks for the answer David about the annotation scanning. I guess this still will have to undergo a more detailed design?
> 
> Kind regards,
> 
>         Peter Kriens
> 
> > On 28 sep. 2015, at 19:33, David M. Lloyd <david.lloyd at redhat.com <mailto:david.lloyd at redhat.com>> wrote:
> >
> > On 09/28/2015 12:05 PM, Peter Kriens wrote:
> >> Dependency injection subsystems (Guice,CDI, Spring) tend to require annotation scanning. This should be able to iterate over implementation classes that are not exported.
> >>
> >> I could not find how you could iterate over the classes in a module. If there is no such way, how will CDI work with modules?
> >
> > This one I can answer, at least partially: modules are likely to be indexed or contain an index of annotated classes.  The index is presumably keyed by any annotation annotated in turn with the @Indexed annotation (package TBD I believe).  The following excerpt from the requirements doc (heading "Development") is relevant:
> >
> >> One potential approach is to augment a module’s definition with an index of the annotations that are present in the module, together with an indication of the elements to which each annotation applies. To limit the size of the index, only annotations which themselves are annotated with a new meta-annotation, say @Indexed, would be included.
> >
> >
> > --
> > - DML
> 
> 



More information about the jpms-spec-experts mailing list