You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/antora/modules/ROOT/pages/fundamentals.adoc
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
= Fundamentals
3
3
4
4
Spring Modulith supports developers implementing logical modules in Spring Boot applications.
5
-
It allows them to apply structural validation, document the module arrangement, run integration tests for individual modules, observe the modules interaction at runtime and generally implement module interaction in a loosely-coupled way.
5
+
It allows them to apply structural validation, document the module arrangement, run integration tests for individual modules, observe the modules' interaction at runtime, and generally implement module interaction in a looselycoupled way.
6
6
This section will discuss the fundamental concepts that developers need to understand before diving into the technical support.
7
7
8
8
[[modules]]
@@ -25,10 +25,10 @@ That is the class, that is annotated with `@SpringBootApplication` and usually c
25
25
By default, each direct sub-package of the main package is considered an _application module package_.
26
26
27
27
If this package does not contain any sub-packages, it is considered a simple one.
28
-
It allows to hide code inside it by using Java's package scope to hide types from being referred to by code residing in other packages and thus not subject for dependency injection into those.
28
+
It allows to hide code inside it by using Java's package scope to hide types from being referred to by code residing in other packages and thus not subject to dependency injection into those.
29
29
Thus, naturally, the module's API consists of all public types in the package.
30
30
31
-
Let us have a look at an example arrangement (icon:plus-circle[role=green] denotes a public type, icon:minus-circle[role=red] a package protected one).
31
+
Let us have a look at an example arrangement (icon:plus-circle[role=green] denotes a public type, icon:minus-circle[role=red] a package-private one).
32
32
33
33
.A single inventory application module
34
34
[source, subs="+specialchars, macros"]
@@ -67,10 +67,10 @@ icon:cubes[] Example
67
67
68
68
In such an arrangement, the `order` package is considered an API package.
69
69
Code from other application modules is allowed to refer to types within that.
70
-
`order.internal`, just as any other sub-package of the application module base package are considered _internal_ ones.
70
+
`order.internal`, just as any other sub-package of the application module base package, is considered an _internal_ one.
71
71
Code within those must not be referred to from other modules.
72
72
Note, how `SomethingOrderInternal` is a public type, likely because `OrderManagement` depends on it.
73
-
This unfortunately means, that it can also be referred to from other packages such as the `inventory` one.
73
+
This unfortunately means that it can also be referred to from other packages such as the `inventory` one.
74
74
In this case, the Java compiler is not of much use to prevent these illegal references.
75
75
76
76
[[modules.explicit-dependencies]]
@@ -125,9 +125,9 @@ Kotlin::
125
125
var modules = ApplicationModules.of(Application::class)
126
126
----
127
127
======
128
-
To get an impression about what the analyzed arrangement looks like, we can just write the individual modules contained in the overall model to the console:
128
+
To get an impression of what the analyzed arrangement looks like, we can just write the individual modules contained in the overall model to the console:
129
129
130
-
.Writing the application module arranagement to the console
130
+
.Writing the application module arrangement to the console
Note, how each module is listed and the contained Spring components are identified and the respective visibility is rendered, too.
164
+
Note how each module is listed, the contained Spring components are identified, and the respective visibility is rendered, too.
165
165
166
166
[[modules.named-interfaces]]
167
167
=== Named Interfaces
168
168
169
169
By default and as described in xref:fundamentals.adoc#modules.advanced[Advanced Application Modules], an application module's base package is considered the API package and thus is the only package to allow incoming dependencies from other modules.
170
170
In case you would like to expose additional packages to other modules, you need to use __named interfaces__.
171
-
You achieve that by annotating the `package-info.java` file of those package with `@NamedInterface`.
171
+
You achieve that by annotating the `package-info.java` file of those packages with `@NamedInterface`.
172
172
173
173
.A package arrangement to encapsulate an SPI named interface
174
174
[source, text, subs="macros, quotes"]
@@ -205,7 +205,7 @@ Kotlin::
205
205
package example.order.spi
206
206
----
207
207
======
208
-
The effect of that declaration is two fold: first, code in other application modules is allowed to refer to `SomeSpiInterface`.
208
+
The effect of that declaration is twofold: first, code in other application modules is allowed to refer to `SomeSpiInterface`.
209
209
Application modules are able to refer to the named interface in explicit dependency declarations.
210
210
Assume the __inventory__ module was making use of that, it could refer to the above declared named interface like this:
0 commit comments