Search code examples
springspring-bootmicroservicesspring-cloudspring-cloud-config

When spring config server is down and GIT under maintenance and spring config client at the initial startup


Spring Config-Client is in initial startup so It would not have cached the data from config server, if either Config-Server or GIT or both are down - what can be done in that case to get the data and maintain service availability.


Solution

  • You can use the following (basedir) element of yml file with following hierarchy. The "basedir" element will cache your config data whenever application restarts and keep that on the specified path which is specified against this key as a value. Example : basedir : C:\POC_CONFIG_SERVER\config-repo-am

    server:
      port: 8888
    
    spring:
      application:
        name: cloud-config-server
      cloud:
        config:
          server:
            git:
              uri: ${uri}
              force-pull: true
              skip-ssl-validation: true
              skipSslValidation: true
              username: ${username}
              password: '${password}'
              default-label: master
              basedir: ${basedir}