Spring Cloud Config – 文件扩展名不被 Openshift 中的任何 PropertySourceLoader 所知。

huangapple go评论56阅读模式
英文:

Spring Cloud Config - File extension is not known to any PropertySourceLoader in Openshift

问题

这是我的application.yml文件:

spring:
  application:
    name: app
    version: @project.version@
  config:
    import: optional:configserver:${CLOUD_CONFIG_SERVER_URL}
  cloud:
    config:
      uri: ${CLOUD_CONFIG_SERVER_URL}
      username: ${CLOUD_CONFIG_USERNAME}
      password: ${CLOUD_CONFIG_PASSWORD}
      label: ${CLOUD_CONFIG_LABEL:develop}

我使用的依赖是:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-config</artifactId>
</dependency>

Spring Boot版本为2.4.5,这是一个Maven多模块项目。应用程序属性位于'boot'模块中。

在本地一切正常,但在Openshift中,我总是收到以下错误消息:

"File extension is not known to any PropertySourceLoader. If the location is meant to reference a directory, it must end in '/'"

不太确定可能漏掉了什么。

英文:

Here is my application.yml

spring:
  application:
    name: app
    version: @project.version@
  config:
    import: optional:configserver:${CLOUD_CONFIG_SERVER_URL}
  cloud:
    config:
      uri: ${CLOUD_CONFIG_SERVER_URL}
      username: ${CLOUD_CONFIG_USERNAME}
      password: ${CLOUD_CONFIG_PASSWORD}
      label: ${CLOUD_CONFIG_LABEL:develop}

The dependency I'm using is

&lt;dependency&gt;
            &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
            &lt;artifactId&gt;spring-cloud-starter-config&lt;/artifactId&gt;
        &lt;/dependency&gt;

Spring Boot v2.4.5, Maven multi-module project. The application properties are in 'boot' module.

Locally everything is working, but in Openshift I always get:

"File extension is not known to any PropertySourceLoader. If the location is meant to reference a directory, it must end in '/'"

Not really sure what could be missed out.

答案1

得分: 1

我遇到了同样的问题,并通过在config: import语句后添加"/"来解决了它。

config:
import: optional:configserver:${CLOUD_CONFIG_SERVER_URL}/

英文:

I have encountered with the same issue and I have resolved by adding "/" after config: import statement.

config:
    import: optional:configserver:${CLOUD_CONFIG_SERVER_URL}/

huangapple
  • 本文由 发表于 2023年5月25日 22:38:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76333500.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定