【问题标题】:Disable GraphiQL playground on production in spring boot application在 Spring Boot 应用程序的生产环境中禁用 GraphiQL Playground
【发布时间】:2021-08-19 12:49:49
【问题描述】:

我在graphiql Playground 的spring boot 应用程序中添加了pom 依赖项,带有“graphiql-spring-boot-starter-5.0.2.jar”依赖项。

现在我想为生产环境禁用 Playground。

并已尝试使用如下的 Spring Boot 应用程序,但这些选项都无法禁用 GraphiQL 端点。

  1. graphiql.enabled=假
  2. dgs.graphql.graphiql.enabled=false

您能否建议我们如何禁用 GraphiQL?

【问题讨论】:

    标签: java spring-boot graphql graphql-java graphiql


    【解决方案1】:

    您实际上可以在 application.yml 或 application.properties 中的生产配置文件中添加以下配置,以禁用生产中的 Playground。

    我已经用 com.graphql-java:playground-spring-boot-started:11.0.0

    对其进行了测试

    在 application.yml 中

    graphql:
     playground:
      enabled: false
    

    在 application.properties 中

    graphql.playground.enabled = false

    【讨论】:

      猜你喜欢
      • 2023-03-28
      • 2017-12-29
      • 1970-01-01
      • 1970-01-01
      • 2018-01-17
      • 2023-03-06
      • 2020-08-26
      • 2020-09-25
      相关资源
      最近更新 更多