首先,pom 继承父类工程,并引入 springcloud 集成 eureka 的相应库,如下截图

<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
</dependencies>
其次,工程启动 application 开启通过注解开启 eureka 服务代码如下:
@EnableEurekaServer
@SpringBootApplication
public class Eureka8081Application {public static void main(String[] args) {SpringApplication.run(Eureka8081Application.class, args);
}
}
最后,当然需要配置文件

当然,更多的配置如心跳等设定,去百度搜索更多的配置吧,启动成功后如图:

正文完