首页 > 解决方案 > 如何在新的 Spring Boot 2.4 中迁移 kubernetes 配置

问题描述

我按照这个例子在 kubernetes 中加载更多的配置映射,所以我在我的项目中创建了 bootstrap.properties。但是,spring boot 2.4 现在不再支持 bootstrap,但我找不到如何在doc中替换它

现在我的属性看起来像:

引导程序:

spring:
  application:
    name: @appname@
  cloud:
    kubernetes:
      config:
        sources:
          - name: "@appname@"
          - name: "@appname@-db"
      reload:
        enabled: true

和应用程序 Kubernetes:

spring:
  mvc:
    servlet:
      path: /mypath/
server:
  servlet:
    context-path: "@default.context.path@"
  port: 8080

management:
  server.port: 8081
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      probes:
        enabled: true
    shutdown:
      enabled:
        true
  metrics:
    export:
      prometheus.enabled: true
  health:
    livenessstate:
      enabled: true
    readinessstate:
      enabled: true  

捕捉新的弹簧靴功能的正确方法是什么?

更新

在这里,我在应用程序属性中找到了配置源无法通过的另一个链接

标签: springspring-bootkubernetes

解决方案


推荐阅读