From d0afbe40e6c5e925de82bb1fa567a218d9aa126f Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 20 May 2022 15:14:59 +0200 Subject: [PATCH] Tag EventListener as a reflective operation This commit adds compatibility of declarative event listeners in a native image. See gh-28475 --- .../java/org/springframework/context/event/EventListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-context/src/main/java/org/springframework/context/event/EventListener.java b/spring-context/src/main/java/org/springframework/context/event/EventListener.java index 2357f6dc6cf..28ebecfa4ea 100644 --- a/spring-context/src/main/java/org/springframework/context/event/EventListener.java +++ b/spring-context/src/main/java/org/springframework/context/event/EventListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.function.Predicate; +import org.springframework.aot.hint.annotation.Reflective; import org.springframework.context.ApplicationEvent; import org.springframework.core.annotation.AliasFor; @@ -89,6 +90,7 @@ import org.springframework.core.annotation.AliasFor; @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented +@Reflective public @interface EventListener { /**