How to extend Java annotation?

前端 未结 6 1248
闹比i
闹比i 2020-12-09 01:08

In my project I use pre-defined annotation @With:

@With(Secure.class)
public class Test { //....

The source code of @Wit

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-09 01:58

    So the provided answer from Eric Jiang is 100% working in my situation and she is: I need JMSListener ,but i want to hide the destination name:

    @GetPlayerDataByUUIDListener
        public void getPlayerDataByUUID(Object message) {
            System.out.println("Im Here");
        }
    

    `

    @JmsListener(destination = PlayerStatisticsJMSConstants.GET_PLAYER_DATA_BY_UUID)
    @Target({ElementType.METHOD})
    @Retention(RetentionPolicy.RUNTIME)
    public @interface GetPlayerDataByUUIDListener {
    }
    

    So this is working perfectly ,and it is the same as:

    @JmsListener(destination = "example")
        @GetPlayerDataByUUIDListener
        public void getPlayerDataByUUID(Object message) {
            System.out.println("Im Here");
        }
    

提交回复
热议问题