avaje / avaje-inject

Dependency injection via APT (source code generation) ala "Server-Side Dagger DI"
https://avaje.io/inject
Apache License 2.0
227 stars 21 forks source link

Remove @Service from InjectExtension as not required #627

Closed rbygrave closed 2 months ago

rbygrave commented 2 months ago

I think it is clearer if @Service is not here as it isn't used or required.

SentryMan commented 2 months ago

No it's needed, avaje spi only know how to avoid colliding correctly if @Service is there.

rbygrave commented 2 months ago

avaje spi only know how to avoid colliding

It avoids collision via the hard coded exclusions, so in that way it isn't needed. I'm thinking you agree as you reopened this PR?

SentryMan commented 2 months ago

I closed it as a mistake before we could talk it out

rbygrave commented 2 months ago

Ok, we can close this. Copying description from jsonb here:


This is required in order to support the use of avaje-spi-serivce @ServiceProvider with other custom InjectExtension service implementations.

Custom InjectExtension implementations can be registered explicitly with META-INF/services entries OR we can use @ServiceProvider for that to automatically happen.

The reason the @Service is required on the InjectExtension interface is so that avaje-spi-service actually ignores it correctly (and thus allowing avaje-jsonb-generator to process it with the generated InjectExtension implementations). Without this  avaje-spi-service incorrectly assumes that the top level interface is the service interface and then doesn't ignore it and instead generates an incorrect file in target/classes/META-INF/services.