File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
spring-modulith-core/src/main/java/org/springframework/modulith/core Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public static ApplicationModuleInformation of(JavaPackage javaPackage) {
5050
5151 var lookup = AnnotationLookup .of (javaPackage .toSingle (), __ -> true );
5252
53- return JMoleculesTypes .isPresent () && JMoleculesModule .supports (lookup )
53+ return JMoleculesTypes .isModulePresent () && JMoleculesModule .supports (lookup )
5454 ? new JMoleculesModule (lookup )
5555 : new SpringModulithModule (lookup );
5656 }
Original file line number Diff line number Diff line change @@ -52,21 +52,35 @@ static class JMoleculesTypes {
5252 private static final String MODULE = ANNOTATION_PACKAGE + ".Module" ;
5353
5454 private static final boolean PRESENT = ClassUtils .isPresent (AT_ENTITY , JMoleculesTypes .class .getClassLoader ());
55+ private static final boolean MODULE_PRESENT = ClassUtils .isPresent (MODULE , JMoleculesTypes .class .getClassLoader ());
5556
5657 static final String AT_DOMAIN_EVENT_HANDLER = BASE_PACKAGE + ".event.annotation.DomainEventHandler" ;
5758 static final String AT_DOMAIN_EVENT = BASE_PACKAGE + ".event.annotation.DomainEvent" ;
5859 static final String DOMAIN_EVENT = BASE_PACKAGE + ".event.types.DomainEvent" ;
5960
61+ /**
62+ * Returns whether jMolecules is generally present.
63+ *
64+ * @see #isModulePresent()
65+ */
6066 public static boolean isPresent () {
6167 return PRESENT ;
6268 }
6369
70+ /**
71+ * Returns whether the jMolecules {@link Module} type is present. We need to guard for this explicitly as the Kotlin
72+ * variant of jMolecules DDD does not ship that type.
73+ */
74+ public static boolean isModulePresent () {
75+ return MODULE_PRESENT ;
76+ }
77+
6478 @ Nullable
6579 @ SuppressWarnings ("unchecked" )
6680 public static Class <? extends Annotation > getModuleAnnotationTypeIfPresent () {
6781
6882 try {
69- return isPresent ()
83+ return isModulePresent ()
7084 ? (Class <? extends Annotation >) ClassUtils .forName (MODULE , JMoleculesTypes .class .getClassLoader ())
7185 : null ;
7286 } catch (Exception o_O ) {
You can’t perform that action at this time.
0 commit comments