jiriOndrusek-agent commented on PR #28496:
URL: https://github.com/apache/camel/pull/28496#issuecomment-6420851458
@davsclaus Thanks! Changes are in `8753588628` (the branch is also rebased
on main).
1. **Autowiring** – Done. `transactionStrategy` is now `@Metadata(autowired
= true)` (`JpaComponent.java:46`), so autowiring sets it and honours
`autowiredEnabled`. The configurer and the catalog are regenerated. The
component DSL has no change, as it has no autowired marker (same for
`dataSource` of camel-sql).
The component keeps its lookup, but only when autowiring is enabled
(`JpaComponent.java:186-194`). A component added with
`context.addComponent(...)` is initialized before it is autowired
(`AbstractCamelContext.java:514-529`). Without the lookup, the default would be
created first and the bean ignored. The endpoint lookup uses the rule for
autowired endpoint options (`DefaultEndpoint.java:495`), see
`JpaEndpoint.java:625-629`.
Tests: `testJpaComponentTransactionStrategyAutowired`, plus
`testJpaComponent…` and
`testJpaEndpointTransactionStrategyNotFromRegistryWhenAutowiringDisabled`.
2. **Logging** – The WARN is never logged by both the component and the
endpoints. Endpoints copy the component's strategy
(`JpaEndpoint.java:660-661`). They resolve their own only when the component
has none, i.e. when it has no `EntityManagerFactory` (`JpaComponent.java:187`).
Then each endpoint creates its own default, so one WARN per endpoint matches
what happens; I kept it. Added the INFO for the picked bean
(`JpaHelper.java:106`). It shows the bean, not its id: the lookup stays
`findSingleByType`, the same call autowiring uses
(`LifecycleStrategySupport.java:259`), so both always pick the same bean.
3. **Upgrade guide** – Both points are added.
4. **Comment** – Updated (`JpaHelper.java:134-135`). `FactoryFinder` was
considered. It needs a `CamelContext`, which the repositories don't have.
`newInstance` uses the no-arg constructor, while `DefaultTransactionStrategy`
needs the context and the factory, so it would also need a new factory SPI. One
private method needs neither.
5. **Tests** – Added `JpaMessageIdRepositoryTest` for the 2-arg constructor.
`testJpaEndpointTransactionStrategyFromRegistry` now gives the endpoint a
factory and closes it.
6. **Backport** – Agreed, this needs an explicit decision. I'd keep this PR
on main only. On 4.22.x, Camel Quarkus can keep handling it in its extension,
so the LTS line gets no behaviour or API change.
_Generated with [Claude Code](https://claude.com/claude-code) on behalf of
@JiriOndrusek_
--
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]