Is it possible to use a stereotype for @Inject?

I have a repeating annotation in my application that introduces an object created by the CDI producer.

@Inject
@FlatGeometryLive
FlatGeometry geoObject;

I wonder if it is possible to write the stereotype "@FlatGeometryLiveInject", so I need to write

@FlatGeometryLiveInject
FlatGeometry geoObject;

and the object is entered. Is this possible with CDI 1.1 or any DI card?

+4
source share
1 answer

I don’t think it’s possible, because the frameworks you use know at a certain point in your code the annotations whose names are Injectand FlatGeometryLive. If you define a new annotation, how can these structures be aware and act accordingly, of your newly created annotation?

, IDE IDE: aif ( Inject FlatGeometryLive), .

+3

Source: https://habr.com/ru/post/1541940/


All Articles