springcloud的学习---euerka消费者注册进服务注册中心

本文档介绍了如何将消费者应用的80端口注册到Eureka服务注册中心。首先,在pom.xml中引入Eureka客户端依赖;接着,配置yaml文件,设置服务器端口为80,并指定Eureka服务的注册和发现参数;最后,在主启动类上启用@EnableEurekaClient注解,启动服务注册。
摘要由CSDN通过智能技术生成

把消费者80端口也注册进我们的服务注册中心:
1在原先的pom文件里面导入

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

2然后去 编写我们的yml文件

server:
  port: 80
spring:
  application:
    name: cloud-consumer-order
eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://localhost:7001/eureka/

3最后去主启动类里开启注解@EnableEurekaClient

package com.zsp.springcloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
@EnableEurekaClient
public class OrderMain80 {
    public static void main(String[] args) {
        SpringApplication.run(OrderMain80.class,args);
    }
}

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值