Automatic disable of JDBC driver extensions

138 views
Skip to first unread message

Alex Soto Bueno

unread,
Jan 14, 2021, 7:52:31 AM1/14/21
to Quarkus Development mailing list
Hi, today I have been developing a project in Quarkus where I register two data sources, one to be used during dev mode and the other in production:

%dev.quarkus.datasource.db-kind=h2
%dev.quarkus.datasource.username=sa
%dev.quarkus.datasource.password=
%dev.quarkus.datasource.jdbc.url=jdbc:h2:mem:todo

quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=root
quarkus.datasource.jdbc.url=jdbc:postgresql://cockroachdb-public:26257/todo

When I start the application in dev mode, I can see that both drivers extension  are registered and started:

021-01-14 13:45:42,932 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache, jdbc-h2, jdbc-postgresql, mutiny, narayana-jta, resteasy, resteasy-jsonb, smallrye-context-propagation, smallrye-graphql, smallrye-openapi, swagger-ui]

In dev mode it is not a big issue, but in other modes it might be an issue (thinking in terms of memory or security). Would it be any way to detect this and not load the drivers that are not used?

Thanks.

George Gastaldi

unread,
Jan 14, 2021, 8:31:49 AM1/14/21
to Alex Soto Bueno, Quarkus Development mailing list
Have you tried putting the drivers in separate maven profiles? 

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/a72db650-ceb0-4318-8cd3-cd838f5c4912n%40googlegroups.com.

Sanne Grinovero

unread,
Jan 14, 2021, 8:56:20 AM1/14/21
to Alex Soto Bueno, George Gastaldi, Quarkus Development mailing list
This should be unnecessary, as we're not going to *load* the driver if
there is no datasource using it.

The "installed features" merely lists the extensions which are
available in the project - they are not "started". I guess we could
try to not list an entry for "dormant" extensions but I don't think
it's worth it; also it might be more valuable to have the
comprehensive list of potentially active extensions, in case there's a
need to diagnose issues.

If you really want it gone, have it excluded via a profile like George suggests.
> To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAMmsnJjAUieyVjzSe-7i-p%2BhTcd22%2BWcCFhQ5tGJjrJxScJ6XA%40mail.gmail.com.

Alex Soto Bueno

unread,
Jan 14, 2021, 8:57:26 AM1/14/21
to Sanne Grinovero, George Gastaldi, Quarkus Development mailing list
Ok, thanks for the update.
Reply all
Reply to author
Forward
0 new messages