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 @@ -44,7 +44,7 @@ public static ApplicationModuleInformation of(JavaPackage javaPackage) {
4444
4545 var rootPackage = javaPackage .toSingle ();
4646
47- return JMoleculesTypes .isPresent () && JMoleculesModule .supports (rootPackage )
47+ return JMoleculesTypes .isModulePresent () && JMoleculesModule .supports (rootPackage )
4848 ? new JMoleculesModule (rootPackage )
4949 : new SpringModulithModule (rootPackage );
5050 }
Original file line number Diff line number Diff line change @@ -51,21 +51,35 @@ static class JMoleculesTypes {
5151 private static final String MODULE = ANNOTATION_PACKAGE + ".Module" ;
5252
5353 private static final boolean PRESENT = ClassUtils .isPresent (AT_ENTITY , JMoleculesTypes .class .getClassLoader ());
54+ private static final boolean MODULE_PRESENT = ClassUtils .isPresent (MODULE , JMoleculesTypes .class .getClassLoader ());
5455
5556 static final String AT_DOMAIN_EVENT_HANDLER = BASE_PACKAGE + ".event.annotation.DomainEventHandler" ;
5657 static final String AT_DOMAIN_EVENT = BASE_PACKAGE + ".event.annotation.DomainEvent" ;
5758 static final String DOMAIN_EVENT = BASE_PACKAGE + ".event.types.DomainEvent" ;
5859
60+ /**
61+ * Returns whether jMolecules is generally present.
62+ *
63+ * @see #isModulePresent()
64+ */
5965 public static boolean isPresent () {
6066 return PRESENT ;
6167 }
6268
69+ /**
70+ * Returns whether the jMolecules {@link Module} type is present. We need to guard for this explicitly as the Kotlin
71+ * variant of jMolecules DDD does not ship that type.
72+ */
73+ public static boolean isModulePresent () {
74+ return MODULE_PRESENT ;
75+ }
76+
6377 @ Nullable
6478 @ SuppressWarnings ("unchecked" )
6579 public static Class <? extends Annotation > getModuleAnnotationTypeIfPresent () {
6680
6781 try {
68- return isPresent ()
82+ return isModulePresent ()
6983 ? (Class <? extends Annotation >) ClassUtils .forName (MODULE , JMoleculesTypes .class .getClassLoader ())
7084 : null ;
7185 } catch (Exception o_O ) {
You can’t perform that action at this time.
0 commit comments