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 @@ -53,21 +53,35 @@ static class JMoleculesTypes {
5353 private static final String MODULE = ANNOTATION_PACKAGE + ".Module" ;
5454
5555 private static final boolean PRESENT = ClassUtils .isPresent (AT_ENTITY , JMoleculesTypes .class .getClassLoader ());
56+ private static final boolean MODULE_PRESENT = ClassUtils .isPresent (MODULE , JMoleculesTypes .class .getClassLoader ());
5657
5758 static final String AT_DOMAIN_EVENT_HANDLER = BASE_PACKAGE + ".event.annotation.DomainEventHandler" ;
5859 static final String AT_DOMAIN_EVENT = BASE_PACKAGE + ".event.annotation.DomainEvent" ;
5960 static final String DOMAIN_EVENT = BASE_PACKAGE + ".event.types.DomainEvent" ;
6061
62+ /**
63+ * Returns whether jMolecules is generally present.
64+ *
65+ * @see #isModulePresent()
66+ */
6167 public static boolean isPresent () {
6268 return PRESENT ;
6369 }
6470
71+ /**
72+ * Returns whether the jMolecules {@link Module} type is present. We need to guard for this explicitly as the Kotlin
73+ * variant of jMolecules DDD does not ship that type.
74+ */
75+ public static boolean isModulePresent () {
76+ return MODULE_PRESENT ;
77+ }
78+
6579 @ Nullable
6680 @ SuppressWarnings ("unchecked" )
6781 public static Class <? extends Annotation > getModuleAnnotationTypeIfPresent () {
6882
6983 try {
70- return isPresent ()
84+ return isModulePresent ()
7185 ? (Class <? extends Annotation >) ClassUtils .forName (MODULE , JMoleculesTypes .class .getClassLoader ())
7286 : null ;
7387 } catch (Exception o_O ) {
You can’t perform that action at this time.
0 commit comments