diff --git a/spring-cloud.html b/spring-cloud.html index c895101..12de7ed 100644 --- a/spring-cloud.html +++ b/spring-cloud.html @@ -429,6 +429,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • Encryption and Decryption
  • Key Management
  • Creating a Key Store for Testing
  • +
  • Embedding the Config Server
  • Spring Cloud Config Client @@ -439,9 +440,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • Refresh Scope
  • Encryption and Decryption
  • Endpoints
  • +
  • Locating Remote Configuration Resources
  • The Bootstrap Application Context
  • -
  • Customizing the Bootstrap
  • -
  • Customizing the Property Sources
  • +
  • Application Context Hierarchies
  • +
  • Changing the Location of Bootstrap Properties
  • +
  • Customizing the Bootstrap Configuration
  • +
  • Customizing the Bootstrap Property Sources
  • Security
  • @@ -600,7 +604,11 @@ via a JSON endpoint. The service has resources in the form:

    -
    /{application}/{profile}[/{label}]
    +
    /{application}/{profile}[/{label}]
    +/{application}-{profile}.yml
    +/{label}/{application}-{profile}.yml
    +/{application}-{profile}.properties
    +/{label}/{application}-{profile}.properties
    @@ -608,7 +616,9 @@ via a JSON endpoint. The service has resources in the form:

    SpringApplication (i.e. what is normally "application" in a regular Spring Boot app), "profile" is an active profile (or comma-separated list of properties), and "label" is an optional git label (defaults to -"master").

    +"master".) The YAML and properties forms are coalesced into a single +map, even if the origin of the values (reflected in the +"propertySources" of the "standard" form) has multiple sources.

    Client Side Usage

    @@ -921,6 +931,19 @@ your application.yml for the Config Server:

    +
    +

    Embedding the Config Server

    +
    +

    The Config Server runs best as a standalone application, but if you +need to you can embed it in another application. Just use the +@EnableConfigServer annotation and (optionally) set +spring.cloud.config.server.prefix to a path prefix, e.g. "/config", +to serve the resources under a prefix. The prefix should start but not +end with a "/". It is applied to the @RequestMappings in the Config +Server (i.e. underneath the Spring Boot prefixes server.servletPath +and server.contextPath).

    +
    +
    @@ -1060,6 +1083,32 @@ application context gets the Environment.

    +

    Locating Remote Configuration Resources

    +
    +

    The Config Service serves property sources from /{name}/{env}/{label}, where the default bindings are

    +
    +
    + +
    +
    +

    All of them can be overridden by setting spring.cloud.config.* +(where * is "name", "env" or "label"). The "label" is useful for +rolling back to previous versions of configuration; with the default +Config Server implementation it can be a git label, branch name or +commit id.

    +
    +
    +

    The Bootstrap Application Context

    The Config Client operates by creating a "bootstrap" application @@ -1090,9 +1139,9 @@ nicely separate. Example:

    -

    It is a good idea to set the spring.application.name in -bootstrap.yml if your application needs any application-specific -configuration from the server.

    +

    It is a good idea to set the spring.application.name (in +bootstrap.yml or application.yml) if your application needs any +application-specific configuration from the server.

    You can disable the bootstrap process completely by setting @@ -1100,7 +1149,79 @@ configuration from the server.

    -

    Customizing the Bootstrap

    +

    Application Context Hierarchies

    +
    +

    If you build an application context from SpringApplication or +SpringApplicationBuilder, then the Bootstrap context is added as a +parent to that context. It is a feature of Spring that child contexts +inherit property sources and profiles from their parent, so the "main" +application context will contain additional property sources, compared +to building the same context without Spring Cloud Config. The +additional property sources are:

    +
    +
    + +
    +
    +

    Because of the ordering rules of property sources the "bootstrap" +entries take precedence, but note that these do not contain any data +from bootstrap.yml, which has very low precedence, but can be used +to set defaults.

    +
    +
    +

    You can extend the context hierarchy by simply setting the parent +context of any ApplicationContext you create, e.g. using its own +interface, or with the SpringApplicationBuilder convenience methods +(parent(), child() and sibling()). Note that the +SpringApplicationBuilder allows you to share an Environment +amongst the whole hierarchy, but that is not the default. Thus, +normally you expect to see differences between different levels in the +hierarchy, and sibling contexts in particular do not need to have the +same profiles or property sources, even though they will share common +things with their parent. Every context in the hierarchy will have its +own "bootstrap" property source (possibly empty) to avoid promoting +values inadvertently from parents down to their descendants.

    +
    +
    +
    +

    Changing the Location of Bootstrap Properties

    +
    +

    The bootstrap.yml (or .properties) location can be specified using +`spring.cloud.bootstrap.name (default "bootstrap") or +spring.cloud.bootstrap.location (default empty), e.g. in System +properties. Those properties behave like the spring.config.* +variants with the same name, in fact they are used to set up the +bootstrap ApplicationContext by setting those properties in its +Environment. If there is an active profile (from +spring.profiles.active or through the Environment API in the +context you are building) then properties in that profile will be +loaded as well, just like in a regular Spring Boot app, e.g. from +bootstrap-development.properties for a "development" profile.

    +
    +
    +
    +

    Customizing the Bootstrap Configuration

    The bootstrap context can be trained to do anything you like by adding entries to /META-INF/spring.factories under the key @@ -1122,7 +1243,7 @@ classes found in spring.factories and then all @Beans

    -

    Customizing the Property Sources

    +

    Customizing the Bootstrap Property Sources

    The default property source for external configuration added by the bootstrap process is the Config Server, but you can add additional @@ -1553,6 +1674,23 @@ annotation in a proxy that is connected to the Hystrix circuit breaker. The circuit breaker calculates when to open and close the circuit, and what to do in case of a failure.

    +
    +

    The state of the connected circuit breakers are also exposed in the +/health endpoint of the calling application.

    +
    +
    +
    +
    {
    +    "hystrix": {
    +        "openCircuitBreakers": [
    +            "StoreIntegration::getStoresByLocationLink"
    +        ],
    +        "status": "CIRCUIT_OPEN"
    +    },
    +    "status": "UP"
    +}
    +
    +
    @@ -1870,7 +2008,7 @@ authentication and a single user account:

    @Controller class Application { - @RequestMapping('/' + @RequestMapping('/') String home() { 'Hello World' } @@ -1891,7 +2029,7 @@ class Application { @EnableOAuth2Sso class Application { - @RequestMapping('/' + @RequestMapping('/') String home() { 'Hello World' } @@ -2045,7 +2183,7 @@ and puts it in a request header for the downstream requests.