Skip to content

Commit 76dc8aa

Browse files
authored
Re-add test runtime hints (#13511)
1 parent 287b097 commit 76dc8aa

File tree

2 files changed

+26
-0
lines changed
  • smoke-tests-otel-starter

2 files changed

+26
-0
lines changed

smoke-tests-otel-starter/spring-boot-3.2/src/main/java/io/opentelemetry/spring/smoketest/RuntimeHints.java

+13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
package io.opentelemetry.spring.smoketest;
77

8+
import org.springframework.aot.hint.MemberCategory;
89
import org.springframework.aot.hint.RuntimeHintsRegistrar;
10+
import org.springframework.aot.hint.TypeReference;
911

1012
// Necessary for GraalVM native test
1113
public class RuntimeHints implements RuntimeHintsRegistrar {
@@ -14,5 +16,16 @@ public class RuntimeHints implements RuntimeHintsRegistrar {
1416
public void registerHints(
1517
org.springframework.aot.hint.RuntimeHints hints, ClassLoader classLoader) {
1618
hints.resources().registerResourceBundle("org.apache.commons.dbcp2.LocalStrings");
19+
20+
// To avoid Spring native issue with MongoDB: java.lang.ClassNotFoundException:
21+
// org.springframework.data.mongodb.core.aggregation.AggregationOperation
22+
hints
23+
.reflection()
24+
.registerType(
25+
TypeReference.of(
26+
"org.springframework.data.mongodb.core.aggregation.AggregationOperation"),
27+
hint -> {
28+
hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
29+
});
1730
}
1831
}

smoke-tests-otel-starter/spring-boot-3/src/main/java/io/opentelemetry/spring/smoketest/RuntimeHints.java

+13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
package io.opentelemetry.spring.smoketest;
77

8+
import org.springframework.aot.hint.MemberCategory;
89
import org.springframework.aot.hint.RuntimeHintsRegistrar;
10+
import org.springframework.aot.hint.TypeReference;
911

1012
// Necessary for GraalVM native test
1113
public class RuntimeHints implements RuntimeHintsRegistrar {
@@ -14,5 +16,16 @@ public class RuntimeHints implements RuntimeHintsRegistrar {
1416
public void registerHints(
1517
org.springframework.aot.hint.RuntimeHints hints, ClassLoader classLoader) {
1618
hints.resources().registerResourceBundle("org.apache.commons.dbcp2.LocalStrings");
19+
20+
// To avoid Spring native issue with MongoDB: java.lang.ClassNotFoundException:
21+
// org.springframework.data.mongodb.core.aggregation.AggregationOperation
22+
hints
23+
.reflection()
24+
.registerType(
25+
TypeReference.of(
26+
"org.springframework.data.mongodb.core.aggregation.AggregationOperation"),
27+
hint -> {
28+
hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
29+
});
1730
}
1831
}

0 commit comments

Comments
 (0)