Fix detection of @DomainEvents and @AfterDomainEventPublication on native.

We now unconditionally process the aggregate root types declared on repositories for @Reflective annotations, which @DE and @ADEP got meta-annotated with.

Fixes #2939.
This commit is contained in:
Oliver Drotbohm
2023-09-21 16:12:19 +02:00
parent 5f64564db5
commit 8328517cc9
6 changed files with 119 additions and 22 deletions

View File

@@ -20,6 +20,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.aot.hint.annotation.Reflective;
/**
* Annotation to be used on a method of a Spring Data managed aggregate to get invoked after the events of an aggregate
* have been published.
@@ -29,8 +31,7 @@ import java.lang.annotation.Target;
* @since 1.13
* @soundtrack Benny Greb - September (Moving Parts Live)
*/
@Reflective
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
public @interface AfterDomainEventPublication {
}
public @interface AfterDomainEventPublication {}

View File

@@ -20,6 +20,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.aot.hint.annotation.Reflective;
/**
* {@link DomainEvents} can be used on methods of aggregate roots managed by Spring Data repositories to publish the
* events returned by that method as Spring application events.
@@ -30,7 +32,7 @@ import java.lang.annotation.Target;
* @since 1.13
* @soundtrack Benny Greb - Soulfood (Moving Parts Live)
*/
@Reflective
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
public @interface DomainEvents {
}
public @interface DomainEvents {}