Spring Cloud(F版)搭建注册中心

本文档详细介绍了如何使用Spring Cloud Finchley.SR3和Spring Boot 2.0.3搭建Eureka服务注册中心。首先,通过IDEA创建Spring Boot项目并添加Eureka Server依赖,然后配置@EnableEurekaServer启动服务。接着,配置应用启动端口和Eureka客户端参数,完成服务注册。最后,验证服务注册成功,展示了Eureka服务治理页面。同时,还涵盖了创建服务提供者的步骤,包括添加Eureka Discovery Client依赖,注册服务,并进行了启动测试。
摘要由CSDN通过智能技术生成

之前使用dubbo搭建了一个系统,不过搭的不是很好,最近开始学Spring Cloud微服务,我感觉Spring Cloud要比dubbo要好用多了,以前在搭dubbo的时候还没有写博客的习惯,很多东西都没有去总结久而久之就忘记了,所以这次学习Spring Cloud我会把自己学习的整个过程都记录下来,既能给自己增加记忆,方便查看,还能和大家分享。

好了,废话不多说,开始Spring Cloud的学习,希望和大家共同进步。

准备环境

  1. JDK 1.8
  2. IDEA 社区版
  3. spring boot 2.0.3
  4. maven 3.2.2

创建服务注册中心

使用IDEA快速创建一个Spring Boot工程,添加Eureka Server组件。【IDEA 社区版 创建spring cloud项目

Eureka Server依赖

我选择spring boot的版本是2.0.3,spring cloud的版本是Finchley.SR3,pom.xml代码如下:

<?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">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.3.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>clarezhou.example</groupId>
	<artifactId>eureka-server-test</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>
	<name>eureka-server-test</name>
	<description>Eureka Server</description>

	<properties>
		<java.version>1.8</java.version>
		<spring-cloud.version>Finchley.SR3</spring-cloud.version>
	</properties>

	<dependencies>
		<!-- Eureka Server依赖 -->
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
		</dependency>

		<!-- 热部署 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
			<op
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值