Original Address: https: //www.cnblogs.com/lplshermie/p/9105329.html
Micro Services and distributed has become a very common technique, in order to keep pace with the times, recently started learning SpringCloud, start from Eureka. The two of them not be introduced, online instructions bunch, just open a search engine, enter keywords enough to understand it, and this paper is a very simple demo recording I follow the example set up eureka online registry, only records only for learning little guidance, the following direct start.
A. Tools
- IDE : Intellij IDEA 2018.1
- JDK : 1.8
- Maven :3.3.9
II. Creating a master project maven
① Open IDEA, create a new project
After selecting the Maven project
Here's what not checked, direct the next step
Click Next
Then click Finish, you've created the project as shown below
III. Creating a Eureka-server module as a service registry
① Right-click the project created, New-> Module
② Select Spring Initializr, and then click Next
③ Input Module infos
④ Highlight Cloud Discovery, the right check Eureka Server
⑤ then all the way directly to the Finish created. After the creation of project structure shown in Fig.
pom.xml items shown below
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.norexis</groupId> <artifactId>eureka-server</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>eureka-server</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.2.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version> </properties> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> <repositories> <repository> <