Quarkus devservices 不启动配置免费 postgres 数据库
Quarkus devservices not starting config free postgres db
我只是想尝试开发服务来在 docker 中启动一个配置免费的 postgres,就像我在 https://quarkus.io/guides/datasource#dev-services-configuration-free-databases
上看到的那样
生成了一个 quarkus 项目 https://code.quarkus.io/ 依赖 quarkus-jdbc-postgresql
application.properties 看起来像
quarkus.datasource.devservices.enabled=true
quarkus.datasource.db-kind=postgresql
quarkus.datasource.devservices.port=5432
启动 quarkus 不会启动 postgres,相反我收到一条警告,说 quarkus 不理解它自己的属性,请参阅 Quarkus 日志
2022-03-09 23:11:14,433 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.datasource.devservices.enabled" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2022-03-09 23:11:14,433 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.datasource.devservices.port" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2022-03-09 23:11:14,433 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.datasource.db-kind" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2022-03-09 23:11:14,936 INFO [io.quarkus] (Quarkus Main Thread) quarkus-resteasy-postgres 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.7.4.Final) started in 2.182s. Listening on: http://localhost:8080
2022-03-09 23:11:14,937 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-03-09 23:11:14,937 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, jdbc-postgresql, resteasy, smallrye-context-propagation, vertx]
知道这里发生了什么吗?
根据您的警告消息,此配置缺少一个扩展程序:
2022-03-09 23:11:14,433 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.datasource.db-kind" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
您可以通过将这些依赖项之一添加到您的项目(在您的 pom.xml 上)来解决您的问题:
汇集您的数据库连接(包含在 Hibernate ORM 中)
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>
或
休眠 ORM
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>
我只是想尝试开发服务来在 docker 中启动一个配置免费的 postgres,就像我在 https://quarkus.io/guides/datasource#dev-services-configuration-free-databases
上看到的那样生成了一个 quarkus 项目 https://code.quarkus.io/ 依赖 quarkus-jdbc-postgresql
application.properties 看起来像
quarkus.datasource.devservices.enabled=true
quarkus.datasource.db-kind=postgresql
quarkus.datasource.devservices.port=5432
启动 quarkus 不会启动 postgres,相反我收到一条警告,说 quarkus 不理解它自己的属性,请参阅 Quarkus 日志
2022-03-09 23:11:14,433 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.datasource.devservices.enabled" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2022-03-09 23:11:14,433 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.datasource.devservices.port" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2022-03-09 23:11:14,433 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.datasource.db-kind" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2022-03-09 23:11:14,936 INFO [io.quarkus] (Quarkus Main Thread) quarkus-resteasy-postgres 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.7.4.Final) started in 2.182s. Listening on: http://localhost:8080
2022-03-09 23:11:14,937 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-03-09 23:11:14,937 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, jdbc-postgresql, resteasy, smallrye-context-propagation, vertx]
知道这里发生了什么吗?
根据您的警告消息,此配置缺少一个扩展程序:
2022-03-09 23:11:14,433 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.datasource.db-kind" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
您可以通过将这些依赖项之一添加到您的项目(在您的 pom.xml 上)来解决您的问题:
汇集您的数据库连接(包含在 Hibernate ORM 中)
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>
或
休眠 ORM
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>