Subham-KRLX commented on PR #3960:
URL: https://github.com/apache/polaris/pull/3960#issuecomment-4045931648
> > [...] The root cause was DefaultDataSourceResolver unconditionally
injecting a JDBC DataSource bean, which caused an
io.quarkus.arc.InactiveBeanException when booting profiles where JDBC is
disabled (like NoSQL/Mongo).
>
> Current code in this PR LGTM, however, I still wonder why would
`DefaultDataSourceResolver` be "engaged" in non-JDBC contexts (and subsequently
get the `InactiveBeanException`) 🤔
>
> @Subham-KRLX : Could you explore this a bit more?
>
> Perhaps `DefaultDataSourceResolver` may need to be a `@Dependent` bean
rather than `@ApplicationScoped` 🤔
Hi @dimas-b the root issue is Quarkus ArC's eager boot-time validation.Since
DefaultDataSourceResolver
is in runtime-common, it’s always discovered during boot (even in NoSQL
profiles). The Quarkus JDBC extension disables the DataSource bean when JDBC is
off.
A direct @Inject DataSource causes Quarkus to throw an InactiveBeanException
immediately at boot because the required injection point cannot be satisfied.
By using @Inject Instance<DataSource>, we make the injection point
dynamic/lazy, bypassing the strict upfront validation. (Even if the bean were
@Dependent, Quarkus ArC still eagerly validates all discovered injection points
by default).
--
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]