SpringCloud Study Notes (2) -- Config, springcloud Study Notes

Source: Internet
Author: User

SpringCloud Study Notes (2) -- Config, springcloud Study Notes

Refer to Spring Cloud official documentation 4th ~ Chapter 10

The configurations in all examples in the official website are on git.

Https://github.com/spring-cloud-samples/config-repo

 

Part II. Spring Cloud Config4. Quick Start

The default policy for finding the location of a property resource is to clone a git repository and use it to initialize a minimum SpringApplication.

4.1 Client Side Usage

When the program runs, it captures external configurations. By default, it captures local configurations from the local port 8888. You can change this configuration in the bootstrap. properties file. Bootstrap. properties is the context of the program startup phase. Simply put, bootstrap. properties will be loaded before the application. properties file is started.

5. Spring Cloud Config Server

The server provides HTTP to obtain external configurations (key-value pairs or content in YAML format) through resource APIs ). Spring Boot embeds this operation through @ EnableConfigServer.

5.1 Environment Repository

When Spring Boot loads the configuration, "spring. cloud. name" is equivalent to {application}, and "spring. profiles. active" is equivalent to {profile}

In the repository, you can save the configuration file to a subdirectory and retrieve it through pattern matching.

In addition, placeholders can be used in the Git URL path and in the search path.

10. Spring Cloud Config Client
10.1 Config First Bootstrap

10.2 Discovery First Bootstrap

10.5 Locating Remote Configuration Resources

 

Code on

Three projects are required: eureka-server-demo, config-server-demo, and config-client-demo. Needless to say, the first one focuses on the next two.

First, configure config-server-demo

Then, configure config-client-demo

Start the three projects respectively

Haha! Successful !!!

 

Reference

Http://blog.csdn.net/qq_22841811/article/details/67637796

Related Article

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.