Fix aot-basic example: timer header regression and native-image reflection gaps - #198
Open
Croway wants to merge 3 commits into
Open
Fix aot-basic example: timer header regression and native-image reflection gaps#198Croway wants to merge 3 commits into
Croway wants to merge 3 commits into
Conversation
…ction gaps
The three routes (Java, YAML, XML DSL) logged an empty string for
${header.CamelTimerFiredTime} instead of the timestamp shown in the README.
camel-timer stopped populating fired-time/metadata headers by default in
Camel 4.1 (CAMEL-19817); fix by adding includeMetadata=true to each timer
endpoint, matching the pattern already used in the kafka-oauth example.
Also fixed native-image support, which was previously untested (no local
GraalVM). Building with a current GraalVM (25.3.4 CE) failed at runtime with
MissingReflectionRegistrationError for several Camel-internal classes that
are instantiated via reflection outside of Spring AOT's visibility (type
converter loaders, the Simple/Constant languages, the timer/bean components,
XML/YAML route loaders, etc.), plus a missing SPI resource
(resource-resolver/source) and an unsupported UTF-32BE charset used by
snakeyaml. Added reflect-config.json/resource-config.json (generated via the
GraalVM tracing agent) and a native-image.properties enabling
-H:+AddAllCharsets under META-INF/native-image so `mvn -Pnative
native:compile` produces a working native executable.
Verified: JVM mode (mvn spring-boot:run and java -jar) and native mode
(mvn -Pnative native:compile followed by running the built executable) all
show real timestamps and start successfully, native image starting in ~1ms
of Camel context startup / ~66ms total.
Updated the stale README sample output (Spring Boot 3.1.0 / Camel
4.0.0-SNAPSHOT) to match the current Spring Boot 4.1.1 / Camel
4.23.0-SNAPSHOT versions and current timings, and simplified the GraalVM
install steps since recent distributions bundle native-image by default.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV52HxRX2Ws2u8m575mmpv
Croway
marked this pull request as draft
September 3, 2026 17:38
oscerd
approved these changes
Sep 3, 2026
…etadata.json Replace the classic split reflect-config.json/resource-config.json with the single reachability-metadata.json format GraalVM now prefers, and rename the sibling META-INF/native-image directory (previously only holding the charsets native-image.properties) to reflect that it now also carries this merged reflection/resource metadata. Kept it in a sibling artifact-id directory rather than the example's own (org.apache.camel.springboot.example/camel-example-spring-boot-aot-basic) because Spring AOT's process-aot goal generates its own reachability-metadata.json at that exact path; placing another file there would risk collision during the resource merge into target/classes. Verified with a clean mvn -Pnative native:compile followed by running the built executable: all three routes still start and log real timestamps. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EV52HxRX2Ws2u8m575mmpv
Add a concise recipe to the README (tracing agent, diffing against what Spring AOT and the dependency jars already cover, iterating native builds against the exact GraalVM error messages) so the reachability-metadata.json can be regenerated when the Spring Boot/Camel/GraalVM versions change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EV52HxRX2Ws2u8m575mmpv
Croway
marked this pull request as ready for review
September 4, 2026 07:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
${header.CamelTimerFiredTime}resolving to an empty string in all three routes (Java/YAML/XML DSL). camel-timer stopped populating the fired-time/metadata headers by default in Camel 4.1 (CAMEL-19817); the fix addsincludeMetadata=trueto each timer endpoint, matching the pattern already used in thekafka-oauthexample.MissingReflectionRegistrationErrorfor several Camel-internal classes instantiated via reflection outside of Spring AOT's visibility (type converter loaders, the Simple/Constant languages, the timer/bean components, XML/YAML route loaders, etc.), plus a missing SPI resource (resource-resolver/source) and an unsupportedUTF-32BEcharset used by snakeyaml. Addedreflect-config.json/resource-config.json(generated via the GraalVM tracing agent) and anative-image.propertiesenabling-H:+AddAllCharsetsunderMETA-INF/native-imagesomvn -Pnative native:compilenow produces a working native executable.native-imageby default.Test plan
mvn spring-boot:run(JVM mode) — all three routes log a real timestamp for${header.CamelTimerFiredTime}java -jar target/camel-example-spring-boot-aot-basic-*.jar— same, ~1.2s startupmvn -Pnative native:compilewith GraalVM CE 25.3.4 (installed via sdkman) — builds successfullymvn clean+ native rebuild + run) to confirm reproducibility🤖 Generated with Claude Code
https://claude.ai/code/session_01EV52HxRX2Ws2u8m575mmpv