首页 > 解决方案 > Spring 配置服务器为客户端应用程序中的属性返回 null

问题描述

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 存储库到以下位置

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

请帮助我,以便我继续我的春季云学习。提前致谢。

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

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

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

标签: springmicroservicesspring-cloud-config

解决方案


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

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


推荐阅读