1. Parent project guide package: (Note: Note the corresponding version) A set of supporting version is recommended: (Update time: March 2, 2020)

  2. EurekaServer server construction:

    1. Creating a Maven project
    2. Import eureka-server server dependencies:
    3. Write the application.yml configuration class:
    4. Write startup class:
  3. EurekaClient client uses:

    1. Import eureka-client client dependencies in the module used:
    2. Add eureka configuration to the module configuration file:
    3. Add comments to the module startup class:
  4. Feign implements calls between services:

    1. Callers import dependencies:
    2. The caller starts the class with comments:
    3. The caller writes the client service invocation interface:
    4. The caller uses:
  5. Fuses avoid avalanche effects of service:

    1. When configuring this on fuse:
    2. Write fuse implementation class:
    3. Add the fusing treatment method to the fusing:
  6. Build gateway:

    1. Create a gateway submodule and inject it into Eureka:
    2. Add gateway dependencies:
    3. Configuration file:
    4. Start the class injection gateway:
    5. Effect:
  7. Use filters in gateways:

    1. Write a filter class that inherits the gateway filter class and injects the container:
    2. Resolve loss of information through the network :(pass the header down the filter in the following way)
  8. SpringCloudConfig centralizes configuration files on Github:

    1. Process: Client -> Gateway -> Github get config-> Gateway -> Microservices -> Github get config-> User microservices

    2. File naming rules: {application}-{profile}. Yml or {application}-{profile}. Properties Application Indicates the application name.

    3. Steps:

      1. Upload the configuration file to Github or the code cloud

      2. Config server:

        1. Create config submodule and add dependencies:
        2. Write configuration file:
        3. Add comments to the startup class:
      3. Config client:

        1. Delete the configuration file of the original submodule
        2. Introducing dependencies:
        3. Create a new configuration file (the name bootstrap.yml is fixed)
  9. SpringCloudBus implements automatic configuration updates:

    1. Usage scenario: When the configuration file deployed on the code cloud is modified, the configuration in the code needs to be automatically updated. In this case, SpringCloudBus automatically updates the configuration

    2. Server side:

      1. Import dependencies:
      2. Add configuration:
    3. Client:

      1. Import dependencies:
      2. Add configuration:
    4. After each configuration change, send a request like this to continuously update the configuration effect:

      • Url: http://127.0.0.1:12000/actuator/bus-refresh Method: post
    5. At this point, the configuration is basically complete, but there is a point, such a configuration, only support the configuration of the framework, the custom configuration can not be updated in real time, so the following operation, so that the custom configuration can also be updated:

      • The Controller has an annotation @refreshScope which is used to refresh the configuration
      • PS: Remember this configuration and bring it with you every time you write the Controller layer in the future