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) {
50
50
51
51
var lookup = AnnotationLookup .of (javaPackage .toSingle (), __ -> true );
52
52
53
- return JMoleculesTypes .isPresent () && JMoleculesModule .supports (lookup )
53
+ return JMoleculesTypes .isModulePresent () && JMoleculesModule .supports (lookup )
54
54
? new JMoleculesModule (lookup )
55
55
: new SpringModulithModule (lookup );
56
56
}
Original file line number Diff line number Diff line change @@ -53,21 +53,35 @@ static class JMoleculesTypes {
53
53
private static final String MODULE = ANNOTATION_PACKAGE + ".Module" ;
54
54
55
55
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 ());
56
57
57
58
static final String AT_DOMAIN_EVENT_HANDLER = BASE_PACKAGE + ".event.annotation.DomainEventHandler" ;
58
59
static final String AT_DOMAIN_EVENT = BASE_PACKAGE + ".event.annotation.DomainEvent" ;
59
60
static final String DOMAIN_EVENT = BASE_PACKAGE + ".event.types.DomainEvent" ;
60
61
62
+ /**
63
+ * Returns whether jMolecules is generally present.
64
+ *
65
+ * @see #isModulePresent()
66
+ */
61
67
public static boolean isPresent () {
62
68
return PRESENT ;
63
69
}
64
70
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
+
65
79
@ Nullable
66
80
@ SuppressWarnings ("unchecked" )
67
81
public static Class <? extends Annotation > getModuleAnnotationTypeIfPresent () {
68
82
69
83
try {
70
- return isPresent ()
84
+ return isModulePresent ()
71
85
? (Class <? extends Annotation >) ClassUtils .forName (MODULE , JMoleculesTypes .class .getClassLoader ())
72
86
: null ;
73
87
} catch (Exception o_O ) {
You can’t perform that action at this time.
0 commit comments