Adopt @AutoConfiguration in components-starter#1752
Merged
Croway merged 2 commits intoapache:mainfrom Apr 16, 2026
Merged
Conversation
Regenerated output from updated camel-spring-boot-generator-maven-plugin. All generated auto-configuration classes now use @autoConfiguration(after=...) instead of @configuration(proxyBeanMethods=false) + @AutoConfigureAfter, and constructor injection instead of @Autowired field injection.
Follow-up to the core module migration in apache#1751. Updates the code generator and all hand-written auto-configuration classes in components-starter to use Spring Boot's @autoConfiguration annotation. Generator (SpringBootAutoConfigurationMojo): - Emit @autoConfiguration(after=...) instead of @configuration + @AutoConfigureAfter - Use constructor injection for all generated fields Hand-written auto-configurations (30 files): - Replace @configuration(proxyBeanMethods=false) with @autoConfiguration - Replace @AutoConfigureAfter/@AutoConfigureBefore with after/before/afterName/beforeName attributes - Replace @Autowired field injection with constructor injection or ObjectProvider - Remove redundant @scope(SCOPE_SINGLETON) from cluster service beans - Fix two CamelMetricsAutoConfiguration classes missing @configuration entirely - Add ElementType.PARAMETER to @CamelAwsXRayTracingStrategy for ObjectProvider usage Skipped (correctly kept as @configuration): - ObservationConditionalAutoConfiguration (loaded via @import, not AutoConfiguration.imports) - MicrometerObservabilityConditionalAutoConfiguration (same reason) - All Converter classes (not auto-configurations)
Contributor
|
so this is a more modern SB style |
davsclaus
approved these changes
Apr 15, 2026
Contributor
Author
exactly! -500 lines of code is always good :) it is both a modern approach and some best practices, like avoid Autowired where possible and use constructor injection. this issue describe the changes #1751 |
Contributor
Author
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
Follow-up to #1751. Extends the
@AutoConfigurationadoption from the core module to thecomponents-startermodules and the code generator.SpringBootAutoConfigurationMojo): now emits@AutoConfiguration(after=...)with constructor injection instead of@Configuration(proxyBeanMethods=false)+@AutoConfigureAfter+@Autowiredfield injection@AutoConfiguration, constructor injection,ObjectProviderfor optional dependencies, removed redundant@Scope(SCOPE_SINGLETON)For review readibility:
Test plan
@AutoConfigurationoutput with constructor injection@Configuration,@Component)