SpringBoot:Eureka搭建注册中心
搭建很简单,就以下三个文件:
pom
org.springframework.cloud
spring-cloud-dependencies
Greenwich.SR1
pom
import
org.springframework.boot
spring-boot-starter-parent
2.1.5.RELEASE
pom
import
配置文件
eureka:
client:fetch-registry: false
register-with-eureka: false
instance:
hostname: localhost
server:
port: 20000
spring:
application:name: eureka-server
Application
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {public static void main(String[] args) {
new SpringApplicationBuilder(EurekaServerApplication.class)
.web(WebApplicationType.SERVLET)
.run(args);
}
}
然后启动项目,访问http://localhost:20000/
,能看到以下页面就表示启动成功了!
还没有评论,来说两句吧...