Skip to content

Commit 9d01198

Browse files
committed
fix: prefer loading Vert.x/NeonBee from system class loader
1 parent e98615b commit 9d01198

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/main/java/io/neonbee/config/NeonBeeConfig.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class NeonBeeConfig {
5151

5252
private String trackingDataHandlingStrategy = DEFAULT_TRACKING_DATA_HANDLING_STRATEGY;
5353

54-
private List<String> platformClasses = List.of();
54+
private List<String> platformClasses = List.of("io.vertx.*", "io.neonbee.*", "org.slf4j.*", "org.apache.olingo.*");
5555

5656
private String timeZone = DEFAULT_TIME_ZONE;
5757

@@ -198,15 +198,15 @@ public NeonBeeConfig setTrackingDataHandlingStrategy(String trackingDataHandling
198198
}
199199

200200
/**
201-
* The idea of this method is to define, which classes are considered as platform classes. This is important to know
202-
* to avoid potential class loading issues during the load of a NeonBee Module. Because generally a class which is
203-
* already loaded by the platform shouldn't also be loaded by the class loader which loads the classes for the
204-
* NeonBee Module.<br>
205-
* <br>
201+
* Platform classes are classes to be considered "provided" by the system class loader. NeonBee modules will attempt
202+
* to find platform classes in the system class loader first, before loading them (self-first) from their own (so
203+
* called) module class-loader. This way, you can prevent incompatibility issues across modules and also have
204+
* modules with a much smaller runtime footprint.
206205
*
207-
* Example values: [io.vertx.core.json.JsonObject, io.neonbee.data*, com.foo.bar*]
206+
* Example values: io.vertx.core.json.JsonObject, io.neonbee.data.*, com.foo.bar.*
208207
*
209-
* @return a list of Strings that could contain full qualified class names, or prefixes marked with a *;
208+
* @return a list of strings that either contains a full qualified class names, or class names with * als a wildcard
209+
* character sequence. By default all NeonBee and Vert.x classes are considered platform classes.
210210
*/
211211
public List<String> getPlatformClasses() {
212212
return platformClasses;
@@ -215,6 +215,7 @@ public List<String> getPlatformClasses() {
215215
/**
216216
* Sets classes available by the platform.
217217
*
218+
* @see #getPlatformClasses()
218219
* @param platformClasses a list of class names
219220
* @return the {@linkplain NeonBeeConfig} for fluent use
220221
*/

src/test/java/io/neonbee/config/NeonBeeConfigTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ void testDefaultValues() {
138138
assertThat(defaultConfig.getTrackingDataHandlingStrategy()).isEqualTo(DEFAULT_TRACKING_DATA_HANDLING_STRATEGY);
139139
assertThat(defaultConfig.getTimeZone()).isEqualTo(DEFAULT_TIME_ZONE);
140140
assertThat(defaultConfig.getEventBusCodecs()).isEmpty();
141-
assertThat(defaultConfig.getPlatformClasses()).isEmpty();
141+
assertThat(defaultConfig.getPlatformClasses()).containsExactly("io.vertx.*", "io.neonbee.*", "org.slf4j.*",
142+
"org.apache.olingo.*");
142143
}
143144

144145
@Test

0 commit comments

Comments
 (0)