springboot配置Eureka配置中心Demo,以及遇到的问题和解决方案

本文详细介绍了如何配置Eureka服务注册中心,包括Eureka Server的pom依赖、配置文件、服务提供者和服务消费者的实现。在配置过程中,遇到服务消费者因@Service注解未被扫描导致启动失败的问题。解决方案是调整组件所在包位置或使用@ComponentScan指定扫描包。
摘要由CSDN通过智能技术生成

1、配置Eureka注册中心eureka-server,pom依赖如下:

<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
</dependencies>

 2、Eureka Server实现代码,重点是其中的@EnableEurekaServer注解,后续博文会对设计注解的实现原理进行分析,本篇文章不涉及

@SpringBootApplication
@EnableEurekaServer
public class SpringbootdemoServerApplication {

	public static void main(String[] args) {
		SpringApplication.run(SpringbootdemoServerApplication.class, args);
	}

}

3、Eureka Server配置文件:application.yml

<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值