Croway opened a new pull request, #1777:
URL: https://github.com/apache/camel-spring-boot/pull/1777
## Summary
- Fix `BeanCurrentlyInCreationException` circular dependency between
`CamelContext` and all generated auto-configuration classes (Component,
Language, DataFormat, Rest)
- Fix `PlaceholderResolutionException` for `local.server.port` in
platform-http tests exposed by Spring Framework 7.0.7
## Root cause
The `@AutoConfiguration` migration (commit 136b6c53c47) combined with Spring
Boot 4.0.6 (Spring Framework 7.0.7) triggers `BeanCurrentlyInCreationException`
during `CamelContext` initialization. During `camelContext.build()`, Camel's
`CustomizersLifecycleStrategy` calls
`registry.findByType(ComponentCustomizer.class)` which forces Spring to
instantiate auto-configuration classes that require `CamelContext` in their
constructor — creating a circular dependency.
## Changes
**Code generator** (`SpringBootAutoConfigurationMojo`):
- **Component auto-configs**: Remove `CamelContext` from constructor. Use
`target.getCamelContext()` in the customizer body — the Component already knows
its context when the customizer is invoked
- **Language auto-configs**: Remove `CamelContext` from constructor. Use
`instanceof CamelContextAware` pattern matching — not all Language
implementations extend `LanguageSupport` (e.g. `ExchangePropertyLanguage`)
- **DataFormat/Rest auto-configs**: Use `ObjectProvider<CamelContext>` for
deferred resolution — these are not resolved during `camelContext.build()`
**Hand-written auto-configs**:
- Fix wrong `afterName` package in `SpringBootPlatformHttpAutoConfiguration`
(`servlet.springboot` → `platform.http.springboot`)
- Use `ObjectProvider<CamelContext>` in
`SpringBootPlatformHttpAutoConfiguration.platformHttpEngineRequestMapping()`
**Platform-HTTP tests** (20 files):
- Replace `@LocalServerPort` with
`Environment.getRequiredProperty("local.server.port", Integer.class)` in
`@BeforeEach`. The `local.server.port` property is set during `finishRefresh()`
but beans registered via `@SpringBootTest(classes=...)` are created during
`finishBeanFactoryInitialization()` — before the server port is assigned.
Spring Framework 7.0.7 changed pre-instantiation timing, exposing this latent
issue.
## Test plan
- [x] `mvn test -pl components-starter/camel-platform-http-starter` — 96
passed, 0 failed, 2 skipped (WireMock @Disabled)
- [x] `mvn test -pl core/camel-spring-boot
-Dtest=ThreadPoolConfigurationTest` — passed
- [ ] Full CI build validation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]