Microservice component

Service Registry:

Eureka Zookeeper Consul Nacos

The service call

Ribbon LoadBalancer Feign OpenFeign

The service fuse is degraded

Hystrix Resillence4J Sentinel

The service gateway

Zuul Gateway

Service configuration

Config Apollo Nacos

The service bus

Bus Nacos

Environment construction (Idea 2020.2 edition)

Set the character set to UTF-8

File -> Settings -> Editer -> File Encoding :

  • Global Encoding: UTF-8
  • Project Encoding: UTF-8
  • Default encoding for properties file: UTF-8
  • Transparent nativ to ASCII conversion: Checked

Start the annotation

File -> Settings -> Build,Execution,Deployment -> Compiler -> Annotation Processors: Enable annotation processing: Checked

Setting the JDK Version

File -> Settings -> Build,Execution,Deployment -> Compiler -> Java compiler: Set Target bytecode version to 8 in per-module bytecode version

Set the parent project POM

  1. Set the packaging type to POM<packaging>pom</packaging>
  2. Add dependency version numbers
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> < artifactId > spring - the boot - dependencies < / artifactId > < version > 2.3.4. RELEASE < / version > < type > pom < type > <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Hoxton.SR10</version> <type>pom</type> <scope>import</scope>  </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> < artifactId > spring - the cloud - alibaba - dependencies < / artifactId > < version > 2.2.5. RELEASE < / version > < type > pom < type > <scope>import</scope> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.20</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>mysql</groupId> < artifactId > mysql connector - Java < / artifactId > < version > 8.0.23 < / version > < type > pom < type > the < scope > import < / scope > </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> < artifactId > mybatis - spring - the boot - starter < / artifactId > < version > 2.1.4 < / version > < type > pom < type > the < scope > import < / scope > </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.16</version> <type>pom</type> <scope>import</scope> </dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13.1</version> <scope>test</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> </dependencies> </dependencyManagement>Copy the code

Note: You can place the above dependent versions into properties. In addition, the relevant Spring Boot dependencies are not introduced using the SpringBoot starter approach shown below, as this approach is equivalent to a collection of dependencies, but some of these versions may conflict with the Spring Cloud. It is recommended to introduce it in the same way as above

<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> The < version > 2.3.4. RELEASE < / version > < relativePath / > <! -- lookup parent from repository --> </parent>Copy the code

Enabling hot Deployment

To prevent repeated start-stop debugging after code changes, you can turn on hot deployment

  1. Introduction of depend on
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> < version > 2.3.4. RELEASE < / version > < type > pom < type > the < scope > import < / scope > < / dependency >Copy the code
  1. Add the plug-in
  <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
      <fork>true</fork>
      <addResources>true</addResources>
    </configuration>
  </plugin>
Copy the code
  1. Open the options

File -> Settings -> Compiler, select the following option

  • Automatically show first error in editor
  • Display notification on build completion
  • Build project automatically
  • Compile independent module in parallel
  1. Add the registration

Press CTRL Alt shift/four key at the same time, in the pop-up dialog, select the register, and then select the following two options for the compiler. The automake. Allow. The when. App. Running actionSystem.assertFocusAccessFromEdt 5. Restart the Idea

Start the Run Dashboard

In the Idea 2020 release, Service replaces the previous Run Dashboard to manage the running of multiple microservices simultaneously. Specific operation is as follows: the View – > Tool Window – > Services – > click “+”, in a Window to add Application can show all of your service Reference links: blog.csdn.net/zhang187331…