Construction of microservicecloud-eureka-7001 eureka Service Registry Module
1. Create microservicecloud-eureka-7001
2.pom
<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>
<parent>
<groupId>com.atguigu.springcloud</groupId>
<artifactId>microservicecloud</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>microservicecloud-eureka-7001</artifactId>
<dependencies>
<!--eureka-server服务端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<-! After the changes take effect immediately, hot deployment ->
<artifactId> the Spring-Cloud-Starter-Eureka-Server </ artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies>
</project>
3.yml
Server:
Port: 7001
Eureka:
instance:
hostname: localhost #eureka server instance name
Client:
the Register-with-Eureka: false #false said they did not register itself with the registry.
fetch-registry: false #false said he is the end registry, my duty is to maintain a service instance, you do not need to search services
Service-url:
defaultzone: HTTP: // $ {eureka.instance.hostname}: $ {Server .port} / eureka / # settings interact with Eureka Server address tracking and registration services need to rely on this address.
4.EurekaServer7001_App main startup class
Package Penalty for com.atguigu.springcloud; Import org.springframework.boot.SpringApplication; Import org.springframework.boot.autoconfigure.SpringBootApplication; Import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer // EurekaServer server end of the startup class, receiving a service registration other micro incoming public class EurekaServer7001_App { public static void main (String [] args) { SpringApplication.run (EurekaServer7001_App. class , args); } }
5. Test
First to start EurekaServer
http://localhost:7001/