quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.56k stars 2.63k forks source link

Feature request : Support of meta-annotations (or combined annotations) #42488

Open omasseau opened 1 month ago

omasseau commented 1 month ago

Description

Hello,

Spring supports the possibility to create our own meta-annotations (also known as combined annotations) : https://medium.com/@AlexanderObregon/the-art-of-meta-annotations-in-spring-creating-custom-compositions-86d000d33796

It seems that Quarkus does not support them (at least custom ones. Why I tried it did not work). Would it be possible to add this support in Quarkus ?

It can be very useful when having to repeat the same annotations over and over on many classes.

Implementation ideas

No response

melloware commented 1 month ago

FYI also known as CDI "stereotype" beans. See: https://jakarta.ee/specifications/cdi/3.0/apidocs/jakarta/enterprise/inject/stereotype

not sure if they are supported by Quarkus and CDI Lite spec but I think they are?

Edit: Looks like Quarkus does support @Stereotype

omasseau commented 1 month ago

FYI also known as CDI "stereotype" beans. See: https://jakarta.ee/specifications/cdi/3.0/apidocs/jakarta/enterprise/inject/stereotype

not sure if they are supported by Quarkus and CDI Lite spec but I think they are?

Edit: Looks like Quarkus does support @Stereotype

I'm not sure it is really the same. Meta-annotations can bet set on any class, not only CDI beans

melloware commented 1 month ago

I thought Meta Annotations were "combined" annotations? That is exactly what a stereotype is.

So if you were tired of writing the following on every bean..

@RequestScoped
@Named
@Logging
public class MyBean {

You could make your own "stereotype" that combined those called @MyAnnotation and change the class to

@MyAnnotation
public class MyBean {

Isn't that what you are trying to achieve?

quarkus-bot[bot] commented 1 month ago

/cc @Sanne (core), @aloubyansky (core), @geoand (core), @gsmet (core), @radcortez (core), @stuartwdouglas (core)