【问题标题】:Spring config server return null for properties in client applicationSpring 配置服务器为客户端应用程序中的属性返回 null
【发布时间】:2019-03-21 08:05:17
【问题描述】:

Spring 配置服务器正常工作并返回以下 URL 响应:- http://localhost:8888/limits-service/default

{
    "name": "limits-service",
    "profiles": [
        "default"
    ],
    "label": null,
    "version": "08da3c031373162bca129f75a914f8f4a5ccee8f",
    "state": null,
    "propertySources": [
        {
            "name": "https://github.com/miccloudtest/miccloudtest/limits-service.properties",
            "source": {
                "limits-service.minimum": "1099999",
                "limits-service.maximum": "1008888"
            }
        },
        {
            "name": "https://github.com/miccloudtest/miccloudtest/application.properties",
            "source": {
                "spring.application.name": "spring-client-config-server",
                "server.port": "8888",
                "spring.cloud.config.server.git.uri": "https://github.com/miccloudtest/miccloudtest"
            }
        }
    ]
}

但我的客户端应用程序限制服务返回以下 URL 响应:-http://localhost:8080/limits

{
    "maximum": null,
    "minimum": null
}

我的整个代码上传到 Git 存储库到以下位置

Client Application
Config Server Application

请帮助我,以便我继续我的 Spring Cloud 学习。提前致谢。

客户端应用程序名称是limit-service

配置服务器应用程序名称是客户端配置服务器

Git 资源文件名为limits-servive.properties

【问题讨论】:

    标签: spring microservices spring-cloud-config


    【解决方案1】:

    您的文件名中有 limits-service.properties 的拼写错误。

    【讨论】:

      【解决方案2】:

      如果您说对http://localhost:8888/limits-service/default 的请求完成良好,那么问题一定出在应用程序中。

      我建议你使用 --debug 选项运行应用程序,它会打印很多关于启动的信息。可能有帮助

      【讨论】:

      • 感谢 Mark 的建议,我已尝试使用 Debug 选项,但没有找到任何根本原因。将尝试更多。
      • 我没有看到任何异常
      猜你喜欢
      • 2019-06-04
      • 1970-01-01
      • 2018-08-10
      • 2020-05-02
      • 1970-01-01
      • 2012-06-22
      • 2013-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多