File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
main/java/org/springframework/modulith/core
test/java/org/springframework/modulith/core Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -292,8 +292,9 @@ static boolean isPresent() {
292292 }
293293
294294 static DescribedPredicate <JavaClass > isSpringDataRepository () {
295- return is (assignableTo (SpringDataTypes .REPOSITORY )) //
296- .or (isAnnotatedWith (SpringDataTypes .AT_REPOSITORY_DEFINITION ));
295+
296+ return isInterface ().and (is (assignableTo (SpringDataTypes .REPOSITORY )) //
297+ .or (isAnnotatedWith (SpringDataTypes .AT_REPOSITORY_DEFINITION )));
297298 }
298299 }
299300
@@ -321,4 +322,21 @@ public boolean test(JavaClass t) {
321322 }
322323 };
323324 }
325+
326+ /**
327+ * A {@link DescribedPredicate} matching only interfaces.
328+ *
329+ * @return will never be {@literal null}.
330+ * @since 2.1, 2.0.3, 1.4.8
331+ */
332+ static DescribedPredicate <JavaClass > isInterface () {
333+
334+ return new DescribedPredicate <>("is an interface" ) {
335+
336+ @ Override
337+ public boolean test (JavaClass t ) {
338+ return t .isInterface ();
339+ }
340+ };
341+ }
324342}
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ void doesNotConsiderEntityAggregateRoot() {
107107 assertThat (type .isAggregateRoot ()).isFalse ();
108108 }
109109
110- @ Test
110+ @ Test // GH-1, GH-1541
111111 void considersEntityAnAggregateRootIfTheresARepositoryForIt () {
112112
113113 Map <Class <?>, Boolean > parameters = new HashMap <Class <?>, Boolean >();
@@ -235,6 +235,9 @@ class SampleEntity {}
235235
236236 interface SampleRepository extends CrudRepository <SampleEntity , UUID > {}
237237
238+ // GH-1541
239+ abstract class IntermediateImplementation implements CrudRepository <SampleEntity , UUID > {}
240+
238241 // GH-187
239242 interface ReactiveSampleRepository extends ReactiveCrudRepository <SampleEntity , UUID > {}
240243
You can’t perform that action at this time.
0 commit comments