AutoFactory: Add a way to inject directly, without Provider
Author: anuraagaCreated Apr 8, 2016Updated May 27, 2024
Labelstype=additionComponent: factoryP3
Currently it's only possible for factory parameters to be injected as Providers. In certain DI frameworks (e.g., spring), Provider#get can be slow (lots of reflection) or even dangerous (dependency graph isn't validated until request processing as opposed to startup).
Make sense to add this?
/**
* An annotation to be applied to parameters that should be provided by an
* {@linkplain javax.inject.Inject injected} value in a generated factory.
* Unlike {@link Provided}, this does not use {@link Provider} injection.
*/
@Target(PARAMETER)
public @interface Injected {}Could also be an option to Provided but naming seems like it'd be clunky.
@Provided(direct=true) String hmm,
@Provided(noProvider=true) String maybe,
@Provided(provider=false) String errSource: google/auto