Dan
Dan

Reputation: 2100

Quarkus startup is complaining about deprecated properties

I had a quarkus project up and running on Ubuntu and my dev env was working fine. I then upgraded to a Mac and cloned the project, ran mvn quarkus:dev expecting it all to work fine but sadly that's not the case :(

I get met with a nasty stacktrace telling me that quarkus.datasource.url and quarkus.datasource.driver is deprecated and removed from quarkus versions 1.3 and 1.9. Thing is I don't use either of those properties!!

Here is my application.properties

quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/db?sslmode=disable
quarkus.datasource.username=admin
quarkus.datasource.password=password
quarkus.liquibase.migrate-at-start=true
quarkus.liquibase.change-log=db/changelog/db.changelog-master.xml

And here is the stacktrace

Caused by: io.quarkus.runtime.configuration.ConfigurationException: quarkus.datasource.url and quarkus.datasource.driver have been deprecated in Quarkus 1.3 and removed in 1.9. Please use the new datasource configuration as explained in https://quarkus.io/guides/datasource.
    at io.quarkus.agroal.deployment.AgroalProcessor.build(AgroalProcessor.java:76)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:972)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
    at java.base/java.lang.Thread.run(Thread.java:829)
    at org.jboss.threads.JBossThread.run(JBossThread.java:479)

I am pretty confused as this was working on 1 machine and not the other! Any tips/ideas on how to get passed this?

Upvotes: 1

Views: 1889

Answers (2)

Donald Maparura
Donald Maparura

Reputation: 1

Change application.properties and use application.yml with the following syntax:
 
quarkus:
  datasource:
    db-kind: postgresql
    jdbc:
      url: jdbc:postgresql://localhost:5432/db?sslmode=disable
      username: admin
      password: password
      driver: org.postgresql.Driver
  liquibase:
    migrate-at-start: true
    change-log: db/changelog/db/changelog-master/xml

Upvotes: 0

peterulb
peterulb

Reputation: 2998

As per Config Sources, quarkus takes multiple sources into account. Mainly

  1. (400) System properties

  2. (300) Environment variables

  3. (295) .env file in the current working directory

  4. (260) Quarkus Application configuration file in $PWD/config/application.properties

  5. (250) Quarkus Application configuration file application.properties in classpath

  6. (100) MicroProfile Config configuration file META-INF/microprofile-config.properties in classpath

Additionally properties found in locations defined by the smallrye.config.locations property or SMALLRYE_CONFIG_LOCATIONS environment variable.

This is also set when quarkus.kubernetes.app-config-map=<name of the config map containing the configuration> is used as a single step alternative to the following:

Quarkus supports passing configuration from external locations (via Smallrye Config). This usually requires setting an additional environment variable or system propertiy. When you need to use a secret or a config map for the purpose of application configuration, you need to:
define a volume
mount the volume
create an environment variable for SMALLRYE_CONFIG_LOCATIONS

So in any of these cases, one must be careful that a property source with a higher ordering ordinal doesn't override the default provided by the application.properties.

Upvotes: 3

Related Questions