使用Spring Cloud Config时如何在SpringBoot中使用application.yml加载文本文件

问题描述 投票:0回答:1

我正在使用 Spring Cloud 配置来维护 Gitlab 中的应用程序属性 有没有办法将文本文件加载到属性中? 我尝试使用,但应用程序只能看到字符串 file://myfile.txt 而不是其内容。

my-app:
  file-content: file://myfile.txt
spring-cloud-config
1个回答
0
投票

我认为你必须使用文件的绝对路径而不是相对路径

my-app:
  file-content: file:D:\projct\my-project\resources/myfile.txt

我是 Linux 用户,我不确定地址是否正确:)

© www.soinside.com 2019 - 2024. All rights reserved.