File tree Expand file tree Collapse file tree 4 files changed +67
-1
lines changed
main/java/org/springframework/modulith/core
org/springframework/modulith/core Expand file tree Collapse file tree 4 files changed +67
-1
lines changed Original file line number Diff line number Diff line change @@ -250,7 +250,7 @@ private static List<NamedInterface> ofAnnotatedTypes(JavaPackage basePackage) {
250250 .filter (it -> !JavaPackage .isPackageInfoType (it )) //
251251 .forEach (it -> {
252252
253- if (!it .isAnnotatedWith (org .springframework .modulith .NamedInterface .class )) {
253+ if (!it .isMetaAnnotatedWith (org .springframework .modulith .NamedInterface .class )) {
254254 return ;
255255 }
256256
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package example .metani ;
17+
18+ /**
19+ * @author Oliver Drotbohm
20+ */
21+ @ ModuleApi
22+ public class Exposed {}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package example .metani ;
17+
18+ import static java .lang .annotation .ElementType .*;
19+ import static java .lang .annotation .RetentionPolicy .*;
20+
21+ import java .lang .annotation .Retention ;
22+ import java .lang .annotation .Target ;
23+
24+ import org .springframework .modulith .NamedInterface ;
25+
26+ /**
27+ * @author Oliver Drotbohm
28+ */
29+ @ Retention (RUNTIME )
30+ @ Target ({ TYPE })
31+ @ NamedInterface ("api" )
32+ public @interface ModuleApi {}
Original file line number Diff line number Diff line change @@ -90,6 +90,18 @@ void detectsNamedInterfacesATypeIsContainedIn() {
9090 .containsExactlyInAnyOrder ("spi" , "kpi" );
9191 }
9292
93+ @ Test // GH-1139
94+ void discoveredNamedInterfaceOnComposedAnnotation () {
95+
96+ var pkg = TestUtils .getPackage (example .metani .Exposed .class );
97+
98+ var result = NamedInterfaces .discoverNamedInterfaces (pkg );
99+
100+ assertThat (result ).hasSize (2 )
101+ .extracting (NamedInterface ::getName )
102+ .containsExactlyInAnyOrder (NamedInterface .UNNAMED_NAME , "api" );
103+ }
104+
93105 private static void assertInterfaceContains (NamedInterfaces interfaces , String name , Class <?>... types ) {
94106
95107 var classNames = Arrays .stream (types ).map (Class ::getName ).toArray (String []::new );
You can’t perform that action at this time.
0 commit comments