Quarkus 应用程序的 Prod 中缺少 Swagger UI

问题描述 投票:0回答:1

从 Quarkus docs 来看,必须在

quarkus.swagger-ui.always-include=true
中设置
application.properties
才能在产品中构建 SwaggerUI。

默认情况下,Swagger UI 仅在 Quarkus 启动时可用 开发或测试模式。

但是,即使设置了属性,Swagger UI 仍然不是使用应用程序构建的。

  • mvn clean compile quarkus:dev
2024-03-25 17:46:29,725 INFO  [io.quarkus] (Quarkus Main Thread) test-process 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.16.10.Final) started in 11.997s. Listening on: http://localhost:8080
2024-03-25 17:46:29,725 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2024-03-25 17:46:29,725 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, kogito-addon-persistence-rocksdb-extension, kogito-addon-process-svg-extension, kogito-decisions, kogito-predictions, kogito-processes, kogito-rules, resteasy, resteasy-jackson, security, smallrye-context-propagation, smallrye-health, smallrye-openapi, swagger-ui, vertx]
  • mvn clean package; java -jar target/quarkus-app/quarkus-run.jar
2024-03-25 18:05:44,862 INFO  [io.quarkus] (main) test-process 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.16.10.Final) started in 1.247s. Listening on: http://0.0.0.0:8080
2024-03-25 18:05:44,862 INFO  [io.quarkus] (main) Profile prod activated. 
2024-03-25 18:05:44,862 INFO  [io.quarkus] (main) Installed features: [cdi, kogito-addon-persistence-rocksdb-extension, kogito-addon-process-svg-extension, kogito-decisions, kogito-predictions, kogito-processes, kogito-rules, resteasy, resteasy-jackson, security, smallrye-context-propagation, smallrye-health, smallrye-openapi, vertx]

注意缺少的功能

smallrye-openapi, {swagger-ui}, vertx]

这是我的

application.properties

# Set up for the swagger-ui (Process-defintions)
quarkus.smallrye-openapi.path=/api
quarkus.swagger-ui.always-include=true
quarkus.swagger-ui.path=/swagger

maven swagger swagger-ui quarkus quarkus-rest-client
1个回答
0
投票

我无法重现您在此处描述的问题。当我按照您的描述配置应用程序时,它会启动:

2024-03-26 17:01:35,811 INFO  [io.quarkus] (main) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.8.3) started in 0.629s. Listening on: http://0.0.0.0:8080
2024-03-26 17:01:35,817 INFO  [io.quarkus] (main) Profile prod activated. 
2024-03-26 17:01:35,817 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx]

我发现您正在使用相当旧的 Quarkus:(2.16.10.Final)。这可能就是问题所在。

© www.soinside.com 2019 - 2024. All rights reserved.