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/asciidoc/10-fundamentals.adoc
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -176,4 +176,32 @@ Note how we concatenate the named interface's name `spi` via the double colon `:
176
176
In this setup, code in __inventory__ would be allowed to depend on `SomeSpiInterface` and other code residing in the `order.spi` interface, but not on `OrderManagement` for example.
177
177
For modules without explicitly described dependencies, both the application module root package *and* the SPI one are accessible.
178
178
179
+
[[fundamentals.customizing-modules]]
180
+
=== Customizing Module Detection
179
181
182
+
If the default application module model does not work for your application, the detection of the modules can be customized by providing an implementation of `ApplicationModuleDetectionStrategy`.
183
+
That interface exposes a single method `Stream<JavaPackage> getModuleBasePackages(JavaPackage)` and will be called with the package, the Spring Boot application class resides in.
184
+
You can then inspect the packages residing within that and select the ones to be considered application module base packages based on a naming convention or the like.
185
+
186
+
Assume you declare a custom `ApplicationModuleDetectionStrategy` implementation like this:
187
+
188
+
[source, java]
189
+
----
190
+
package example;
191
+
192
+
class CustomApplicationModuleDetectionStrategy implements ApplicationModuleDetectionStrategy {
193
+
194
+
@Override
195
+
public Stream<JavaPackage> getModuleBasePackages(JavaPackage basePackage) {
196
+
// Your module detection goes here
197
+
}
198
+
}
199
+
----
200
+
201
+
This class needs to be registered in `META-INF/spring.factories` as follows:
0 commit comments