I have a recurring annotation in my app that's injecting an object created by a CDI-producer.
@Inject
@FlatGeometryLive
FlatGeometry geoObject;
I wonder if it's possible to write a stereotype "@FlatGeometryLiveInject" so that i only have to write
@FlatGeometryLiveInject
FlatGeometry geoObject;
and the object is injected. Is this possible with CDI 1.1 or any DI framework?
I don't think it's possible, because the frameworks you are using are aware, in specific point of their code, of annotations which name is Inject
and FlatGeometryLive
. If you define a new annotation how those frameworks could be aware, and act consequently, of your new created annotation?
In order to improve your writing productivity it's better you use your favorite IDE's hints or templates: you might create a shortcut for the text aif
(Annotate with Inject and FlatGeometryLive) that your IDE will expand.