Skip to content

Commit f00e5dc

Browse files
committed
GH-858 - Polishing.
1 parent d510697 commit f00e5dc

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/ApplicationModuleListener.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252

5353
/**
5454
* Whether the transaction to be run for the event listener is supposed to be read-only (default {@literal false}).
55+
*
56+
* @see Transactional#readOnly()
5557
*/
5658
@AliasFor(annotation = Transactional.class, attribute = "readOnly")
5759
boolean readOnlyTransaction() default false;
@@ -72,7 +74,7 @@
7274
* {@code ""}, meaning the event is always handled.
7375
*
7476
* @since 1.2
75-
* @see EventListener#condition
77+
* @see EventListener#condition()
7678
*/
7779
@AliasFor(annotation = EventListener.class, attribute = "condition")
7880
String condition() default "";

spring-modulith-events/spring-modulith-events-api/src/test/java/org/springframework/modulith/events/ApplicationModuleListenerUnitTests.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
package org.springframework.modulith.events;
1717

1818
import static org.assertj.core.api.Assertions.*;
19+
import static org.springframework.core.annotation.AnnotatedElementUtils.*;
1920

2021
import java.lang.reflect.Method;
2122

2223
import org.junit.jupiter.api.Test;
2324
import org.springframework.context.event.ApplicationListenerMethodAdapter;
2425
import org.springframework.context.event.EventListener;
25-
import org.springframework.core.annotation.AnnotatedElementUtils;
2626
import org.springframework.transaction.annotation.Propagation;
2727
import org.springframework.transaction.annotation.Transactional;
2828

@@ -37,17 +37,15 @@ class ApplicationModuleListenerUnitTests {
3737
void exposesEventListenerCondition() throws Exception {
3838

3939
var method = Sample.class.getDeclaredMethod("someMethod", Object.class);
40-
var annotation = AnnotatedElementUtils.findMergedAnnotation(method, EventListener.class);
40+
var annotation = findMergedAnnotation(method, EventListener.class);
4141

4242
assertThat(annotation.condition()).isEqualTo("#{false}");
4343
}
4444

4545
@Test // GH-518
4646
void exposesConditionToAdapter() throws Exception {
4747

48-
var method = Sample.class.getDeclaredMethod("someMethod", Object.class);
49-
50-
var adapter = new CustomAdapter("someName", Sample.class, method) {};
48+
var adapter = new CustomAdapter("someName", Sample.class.getDeclaredMethod("someMethod", Object.class));
5149

5250
assertThat(adapter.getCondition()).isEqualTo("#{false}");
5351
}
@@ -72,8 +70,8 @@ void withCustomPropagation() {}
7270

7371
static class CustomAdapter extends ApplicationListenerMethodAdapter {
7472

75-
public CustomAdapter(String beanName, Class<?> targetClass, Method method) {
76-
super(beanName, targetClass, method);
73+
public CustomAdapter(String beanName, Method method) {
74+
super(beanName, method.getDeclaringClass(), method);
7775
}
7876

7977
/*

0 commit comments

Comments
 (0)