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