java - spring 配置服务器 - 用于本地 git 存储库

标签 java spring git microservices spring-boot-2

我正在尝试设置 Spring Cloud 配置服务器

-在我的本地创建了 git 存储库文件夹 F:\git-local-repository\存储库

- 使用类路径链接源链接它 -为我的服务添加属性文件

-在位置 F:\git-local-repository\repository 提交更改后

-点击网址:http://localhost:8888/limits/default

结果错误: org.springframework.cloud.config.server.environment.NoSuchLabelException:没有这样的标签:master

原因:org.eclipse.jgit.api.errors.RefNotFoundException:Ref master 无法解析

以下是我的 Spring Boot 应用程序的主类

@EnableConfigServer


@SpringBootApplication
public class SpringCloudConfigServerApplication {

public static void main(String[] args) {
    SpringApplication.run(SpringCloudConfigServerApplication.class, args);


}

}

application.properties

spring.application.name=spring-cloud-config-server

server.port=8888

spring.cloud.config.server.git.uri=file:////F:/git-local- 
repository/repository

预期结果:将显示应用程序属性详细信息和其他 url

最佳答案

如果您使用本地目录进行配置。

而不是

spring.cloud.config.server.git.uri=file:////F:/git-local-repository/repository

使用

spring.cloud.config.server.native.search-locations=file:////F:/git-local-repository/repository

关于java - spring 配置服务器 - 用于本地 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57257587/

相关文章:

java - ColdFusion 和 JSoup - 找不到 addTags 方法错误

java - 不完全是 4 位数字长的年份的 JPA 年份验证抛出异常

java - 使用 Proxy Tickets 的 Spring 和 CAS

git - 如何在 pull 请求之后、上游 merge 之前管理 Github 协作的进一步开发

git - 删除/撤消 Sourcetree 上的 merge

java - 返回 JSON 响应

java - 斐波那契使用 1 个变量

java - 回文质数,比较反转数

java - 从 Spring JAR 读取文件

Gitignore 不适用于 .xml 文件和/目标目录