Repository navigation
CAMEL-27103: camel-spring-boot - typeConverterStatisticsEnabled now enables the statistics - #2114
Merged
Conversation
…nables the statistics Same issue as fixed for Camel Main in apache/camel#30303: the type converter registry is created when the CamelContext is built, and its statistics cannot be enabled afterwards (Camel 4.7). CamelAutoConfiguration.doConfigureCamelContext calls camelContext.build() before DefaultConfigurationConfigurer.configure(), so camel.main.type-converter-statistics-enabled=true had no effect. The option is now set on the context before build(); config.getMain() is already bound at that point. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Croway
approved these changes
Nov 19, 2026
Contributor
|
Thanks for the fix! |
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.
Description
Follow-up of CAMEL-27103 and apache/camel#30303, which fixed the same issue in Camel Main.
Problem
camel.main.type-converter-statistics-enabled=truehas no effect in Camel Spring Boot:CamelContext.isTypeConverterStatisticsEnabled()returns true, but the type converter registry keeps the noop statistics and the counters stay at 0.Since Camel 4.7 the statistics collector is chosen once, when the registry is created, which happens when the context is built.
CamelAutoConfiguration.doConfigureCamelContextcallscamelContext.build()beforeDefaultConfigurationConfigurer.configure(camelContext, config.getMain()), which applies the option, so it comes too late.Reproduction
TypeConverterStatisticsEnabledTestfails on main withexpected: <1> but was: <0>:Why it needs a fix
The option is documented for Camel Main and Camel Spring Boot, but in Camel Spring Boot it silently does nothing.
Fix
CamelAutoConfiguration.doConfigureCamelContext: set the option on the context beforecamelContext.build(), next toconfigureStartupRecorder.config.getMain()is already bound by Spring at that point, so there is no need for the early lookup that Camel Main uses.Tested with the camel-spring-boot tests, and with a standalone Spring Boot 4.1.2 application (a timer route converting 10 bodies, counters read through JMX on the
DefaultTypeConverterMBean):AttemptCounterwas 0 before the fix and is 11 with it, withapplication.propertiesor withCAMEL_MAIN_TYPECONVERTERSTATISTICSENABLED=true; it stays at 0 without the option.AI tool used: Claude Code (Claude Opus 5.5), reviewed and checked by me.
Claude Code on behalf of lobtx
🤖 Generated with Claude Code