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