admin管理员组

文章数量:1279112

I have a problem with the Spring Boot Config Server.

Here is my pom.xml

  <parent>
    <groupId>.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.4.2</version>
  </parent>

  <groupId>pl.silent</groupId>
  <artifactId>config-server</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>config-server</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>.springframework.cloud</groupId>
      <artifactId>spring-cloud-config-server</artifactId>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>2024.0.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

Here is my application.yml:

server:
  port: 6611

spring:
  application:
    name: config-server
  profiles:
    active: git, vault
  cloud:
    config:
      server:
        vault:
          host: 127.0.0.1
          port: 8200
          authentication: token
          token: test
          order: 1
        git:
          uri: file://${user.home}/application-configuration
          search-paths: '{application}'
          default-label: master
          username: test
          password: test
          order: 2

When my application calls the Config Server with the application name silent and profile dev, the Config Server doesn't call Vault. It only returns configurations from Git.

I have checked everything: in Vault, the key exists, and I have verified the token. When I connect the Config Server to Vault directly, the properties load correctly into the Config Server application. However, when the internal application calls the Config Server, it doesn't work. I have verified this using curl, and it works fine.

I have a problem with the Spring Boot Config Server.

Here is my pom.xml

  <parent>
    <groupId>.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.4.2</version>
  </parent>

  <groupId>pl.silent</groupId>
  <artifactId>config-server</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>config-server</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>.springframework.cloud</groupId>
      <artifactId>spring-cloud-config-server</artifactId>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>2024.0.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

Here is my application.yml:

server:
  port: 6611

spring:
  application:
    name: config-server
  profiles:
    active: git, vault
  cloud:
    config:
      server:
        vault:
          host: 127.0.0.1
          port: 8200
          authentication: token
          token: test
          order: 1
        git:
          uri: file://${user.home}/application-configuration
          search-paths: '{application}'
          default-label: master
          username: test
          password: test
          order: 2

When my application calls the Config Server with the application name silent and profile dev, the Config Server doesn't call Vault. It only returns configurations from Git.

I have checked everything: in Vault, the key exists, and I have verified the token. When I connect the Config Server to Vault directly, the properties load correctly into the Config Server application. However, when the internal application calls the Config Server, it doesn't work. I have verified this using curl, and it works fine.

Share Improve this question asked Feb 24 at 9:17 MarcinMarcin 211 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

It seems that your Vault is overriden by Git. Try this in your application.yml:

...
    spring:
...
      cloud:
        config:
          allowOverride: false
          overrideNone: true
...

see: https://docs.spring.io/spring-cloud-config/reference/server/environment-repository/using-bootstrap-to-override-properties.html

本文标签: Spring boot config server doesn39t load properties from VaultStack Overflow