首页 > 解决方案 > 带有 SVN 和默认标签的 Spring Cloud 配置服务器纯文本 api

问题描述

我有 spring boot 2 应用程序,它充当具有以下属性的配置服务器。特别注意“默认标签”属性,它是空字符串,因为我们直接检查包含文件的文件夹,而不是某些父分支/文件夹。

spring:
  application:
    name: config-server
  profiles:
    include: subversion
  cloud:
    config:
      server:
        svn:
          uri: https://...somesvnrepo.../project/trunk/config
          username: abc
          password: 123
          default-label:
          basedir: C:\Users\Tom\Documents\MtgLemon\configserver_tmp

/trunk/config 的内容是直截了当的。没有子目录,只有这些文件:

提供 yml 文件可以正常工作,但使用“纯文本 api ”获取 logback.xml 文件根本不起作用。

这样做localhost:8888/appname/default/master/logback.xml会给出错误“找不到标签主机”,这是真的,我没有那个标签。通过省略配置文件或标签的任何其他路径组合都会导致 404 一直到调用localhost:8888/logback.xml. 添加 ?useDefaultLabel 请求参数没有任何区别。实际上,当上下文是获取未绑定到任何特定应用程序、配置文件或标签的纯文本文件时,我不理解 url 的 appname、profile 和 label 部分的用途。

我在互联网上发现了类似的问题,但他们提到更新他们的 Spring Boot 版本,然后它对他们有用。我已经使用了最新的 spring boot 版本(2.1.3-release)。

这是因为我使用SVN吗?还是因为默认标签为空?

标签: springspring-bootsvnspring-cloudconfigserver

解决方案


推荐阅读