1. Create a project
Our registration center, named: leyou-registry
Select New module:
Do not select skeleton:
Then fill in the project coordinate our project name leyou-registry:
Select the installation directory, because it is the aggregation project, the parent directory should be under construction leyou of:
2. Add dependence
Add rely EurekaServer of:
<?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"> <parent> <artifactId>leyou</artifactId> <groupId>com.leyou.parent</groupId> <version>1.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>com.leyou.common</groupId> <artifactId>leyou-registry</artifactId> <version>1.0.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> </dependencies> </project>
// Top configuration class
@SpringBootApplication
// Open eureka server
@EnableEurekaServer
public class WuweiRegistryApplication {
public static void main (String [] args) {
// Start class
SpringApplication.run (WuweiRegistryApplication.class);
}
}
# Modify the port number Server: Port: 10086 # Custom name the Spring: the Application: name: Wuwei - regstry # set the default server path Eureka: Client: Service - url: defaultzone: HTTP: // localhost: 10086 / Eureka # close Register yourself the Register the -with-eureka: false # closed pull eureka service fETCH -registry: false # turn off self-protection mode Server: enable -self-Preservation: false # regular cleaning invalid connection eviction -interval-timer- in -ms:50000
5. The structure of the project
At present, the structure of the entire project is shown: