SpringClould使用-Eureka
项目截图pom引入application.yml启动类上添加@EnableEurekaServer启动测试:
项目截图
pom引入
<?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
>Spring-Cloud-ForLearning
</artifactId
>
<groupId
>com.wx
</groupId
>
<version
>1.0-SNAPSHOT
</version
>
</parent
>
<modelVersion
>4.0.0
</modelVersion
>
<artifactId
>eureka-server
</artifactId
>
<dependencies
>
<dependency
>
<groupId
>org.springframework.cloud
</groupId
>
<artifactId
>spring-cloud-starter-netflix-eureka-server
</artifactId
>
</dependency
>
</dependencies
>
</project
>
application.yml
server:
port: 8080
eureka:
instance:
hostname: localhost
server:
enable-self-preservation:
false
eviction-interval-timer-in-ms: 4000
client:
register-with-eureka:
false
fetch-registry:
false
serviceUrl:
defaultZone: http://
${eureka.instance.hostname}:${server.port}/eureka/
启动类上添加@EnableEurekaServer
启动测试:
http://localhost:8080/