Spring-cloud-config-server--environment Repository

Source: Internet
Author: User
Tags shallow copy

Resources:

Https://cloud.spring.io/spring-cloud-static/spring-cloud-config/1.4.0.RELEASE/single/spring-cloud-config.html

http://cloud.spring.io/spring-cloud-static/Camden.SR7/#_environment_repository

Environment repository--Environment Library

Where do you want to store configuration data for config server? The strategy for managing this behavior is to serve the Enviroment object EnvironmentRepository . This enviroment is a shallow copy of the spring environment domain (including propertysources as the primary function). Environment resources are parameterized by three variables:

    1. {Application} maps to ' Spring.application.name ' on the client side;--{application} is mapped to the "Spring.application.name" of the clients;
    2. {Profile} maps to ' spring.profiles.active ' on the client (comma separated list);--{profile} mapped to the " Spring.profiles.active "(comma-separated list);
    3. {label} which is a server side feature labelling a ' versioned ' Set of config Files.--{label} is a service-side feature that marks a "versioned" set of profiles.

The repository implementation typically loads the configuration file from "Spring.config.name" like the Spring boot application, equivalent to the {application} parameter, while "Spring.profiles.active" is equivalent to {profiles} Parameters. The precedence rules for a profile are the same as in regular boot applications: The active profile takes precedence over the default configuration, and if there are multiple profiles, the last profile wins (such as adding entries to the map).

For example, a client application has this boot configuration:

  Bootstrap.yml

Spring:  application:    name:foo  profiles:    active:dev,mysql

(typically with spring boot applications, these properties can also be set to environment variables or command-line parameters)

If the repository is file-based, the server creates a environment from APPLICATION.YML (shared between all clients) and foo.yml (with yoo.yml precedence). If there are documents in the Yaml file that point to the spring profile, the files are applied at a higher priority (in the order of the profiles listed), and if there is a profile-specific yaml (or attribute) file, the files have a higher precedence than the default values. The higher priority is converted to the Propertysource listed before environment. (These rules are the same for standalone spring boot applications).

Spring-cloud-config-server--environment Repository

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.