【问题标题】:Quarkus GraphQL: How to change the default endpoint?Quarkus GraphQL:如何更改默认端点?
【发布时间】:2020-09-17 22:53:00
【问题描述】:

我在 Quarkus 应用程序中使用如下所示的依赖项。默认端点是/graphql。但是由于我在入口后面的 k8s 环境中运行这个应用程序,所以这并不理想。任何人都知道如何将此默认端点更改为:/<service-name>/graphql

<dependency>
  <groupId>io.smallrye</groupId>
  <artifactId>smallrye-graphql-servlet</artifactId>
  <version>1.0.1</version>
</dependency>

【问题讨论】:

    标签: graphql java-ee-6 quarkus smallrye


    【解决方案1】:

    如果您使用的是 SmallRye GraphQL 扩展,您可以使用 application.properties 控制端点路径:

    quarkus.smallrye-graphql.root-path=/my-path-to-graphql                                                                                                                                                                        
    

    您还可以在值中使用变量(使用${variableName} 语法),这样您就可以在其中注入您的服务名称。

    但是要使用该扩展,您需要将依赖项调整为

       <dependency>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-smallrye-graphql</artifactId>
        </dependency>
    

    请注意,它仅在 Quarkus 1.5.0 之后可用。

    【讨论】:

      猜你喜欢
      • 2020-07-24
      • 1970-01-01
      • 2014-04-08
      • 2018-09-07
      • 2015-05-24
      • 2016-11-02
      • 2016-01-30
      • 2011-10-19
      • 1970-01-01
      相关资源
      最近更新 更多