Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

package io.opentelemetry.spring.smoketest;

import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;

// Necessary for GraalVM native test
public class RuntimeHints implements RuntimeHintsRegistrar {
Expand All @@ -14,5 +16,16 @@ public class RuntimeHints implements RuntimeHintsRegistrar {
public void registerHints(
org.springframework.aot.hint.RuntimeHints hints, ClassLoader classLoader) {
hints.resources().registerResourceBundle("org.apache.commons.dbcp2.LocalStrings");

// To avoid Spring native issue with MongoDB: java.lang.ClassNotFoundException:
// org.springframework.data.mongodb.core.aggregation.AggregationOperation
hints
.reflection()
.registerType(
TypeReference.of(
"org.springframework.data.mongodb.core.aggregation.AggregationOperation"),
hint -> {
hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

package io.opentelemetry.spring.smoketest;

import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;

// Necessary for GraalVM native test
public class RuntimeHints implements RuntimeHintsRegistrar {
Expand All @@ -14,5 +16,16 @@ public class RuntimeHints implements RuntimeHintsRegistrar {
public void registerHints(
org.springframework.aot.hint.RuntimeHints hints, ClassLoader classLoader) {
hints.resources().registerResourceBundle("org.apache.commons.dbcp2.LocalStrings");

// To avoid Spring native issue with MongoDB: java.lang.ClassNotFoundException:
// org.springframework.data.mongodb.core.aggregation.AggregationOperation
hints
.reflection()
.registerType(
TypeReference.of(
"org.springframework.data.mongodb.core.aggregation.AggregationOperation"),
hint -> {
hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
});
}
}
Loading