Second, build a service registry
1. Create a new module in the parent project above myeureka
2. Enter Maven module information
3. Select Cloud Discovery-the Spring> Eureka Server
4.Module generally do not modify the Name, and the project name as Artifact
5. src \ main \ resources following application.properties renamed application.yml, modify the file encoding is UTF-8, as follows
Spring:
Security:
Basic:
enable: to true
User:
name: Li
password: Li
Server:
Port: 1024
Eureka:
instance :
hostname: localhost # eureka server instance name of
Client:
the Register-with-eureka: false # false says he does not need to register itself with the registry
fetch-registry: false # false representation that he is registered center. My job is to maintain a service instance, you do not need to search services
service-url:
defaultZone: http: // $ {eureka.instance.hostname }: $ {server.port} / eureka / # Set the address lookup services and registration services Eureka Server interaction will need to rely on the address (single version)
#defaultZone: HTTP : // localhost: 1024 / eureka / , http: // localhost: 1025 / eureka / # cluster Edition
6. open src \ main \ java \ com \ li \ myeureka following MyeurekaApplication.java
added @EnableEurekaServer notes on startup class , this statement is a registered service center.
@EnableEurekaServer
@SpringBootApplication
public class MyeurekaApplication {
public static void main (String [] args) {
SpringApplication.run (MyeurekaApplication.class, args);
}
}
7. The open a browser to access http: // localhost: 1024 /