IDEA2023.1.3破解,IDEA破解,IDEA 2023.1破解,最新IDEA激活码

Spring Cloud Eureka 服务注册与发现中心

IDEA2023.1.3破解,IDEA破解,IDEA 2023.1破解,最新IDEA激活码

Eureka 介绍

Eureka 是 Spring Cloud 的组件 Spring Cloud Netflix 中的一个模块,负责完成对微服务架构的服务治理功能。

Eureka 服务的三个角色

Eureka 服务端

Eureka 提供的服务端,负责服务的注册与发现功能,一般称为 eureka server。

服务提供者

提供服务的应用,将自己提供的服务注册到 Eureka,以供其他应用发现。

服务消费者

消费者应用从服务注册中心获取提供的服务列表, 从而使消费者可以知道去何处调用其所需要的服务。

引入依赖

pom.xml 中主要添加依赖 spring-cloud-starter-netflix-eureka-server

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

完整 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>
  </parent>

  <groupId>cloud.antoniopeng</groupId>
  <artifactId>hello-spring-cloud-dependencies</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <properties>
    <!-- Environment Settings -->
    <java.version>1.8</java.version>
  </properties>

  <dependencyManagement>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>Finchley.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

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

相关配置

application.yml 中添加以下配置

spring:
  application:
    # 指定唯一服务名称以供调用
    name: hello-spring-cloud-netflix-eureka

server:
  # 指定服务器端口号
  port: 8761

eureka:
  instance:
    # 指定服务器IP地址
    hostname: localhost
  client:
    # 声明为 Eureka Server , 否则会被认为是Eureka Client
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      # 指定服务器完整路径
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

Application 入口类中加上注解 @EnableEurekaServer 开启 Eureka 服务

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

启动项目

访问 Eureka 操作界面 http://localhost:8761

127_1.png

该页面目前没有显示任何服务,因为我们还没有将其它服务注册到 Eureka 中。

文章永久链接:https://tech.souyunku.com/?p=23957


Warning: A non-numeric value encountered in /data/wangzhan/tech.souyunku.com.wp/wp-content/themes/dux/functions-theme.php on line 1154
赞(92) 打赏



未经允许不得转载:搜云库技术团队 » Spring Cloud Eureka 服务注册与发现中心

IDEA2023.1.3破解,IDEA破解,IDEA 2023.1破解,最新IDEA激活码
IDEA2023.1.3破解,IDEA破解,IDEA 2023.1破解,最新IDEA激活码

评论 抢沙发

大前端WP主题 更专业 更方便

联系我们联系我们

觉得文章有用就打赏一下文章作者

微信扫一扫打赏

微信扫一扫打赏


Fatal error: Uncaught Exception: Cache directory not writable. Comet Cache needs this directory please: `/data/wangzhan/tech.souyunku.com.wp/wp-content/cache/comet-cache/cache/https/tech-souyunku-com/index.q`. Set permissions to `755` or higher; `777` might be needed in some cases. in /data/wangzhan/tech.souyunku.com.wp/wp-content/plugins/comet-cache/src/includes/traits/Ac/ObUtils.php:367 Stack trace: #0 [internal function]: WebSharks\CometCache\Classes\AdvancedCache->outputBufferCallbackHandler() #1 /data/wangzhan/tech.souyunku.com.wp/wp-includes/functions.php(5109): ob_end_flush() #2 /data/wangzhan/tech.souyunku.com.wp/wp-includes/class-wp-hook.php(303): wp_ob_end_flush_all() #3 /data/wangzhan/tech.souyunku.com.wp/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters() #4 /data/wangzhan/tech.souyunku.com.wp/wp-includes/plugin.php(470): WP_Hook->do_action() #5 /data/wangzhan/tech.souyunku.com.wp/wp-includes/load.php(1097): do_action() #6 [internal function]: shutdown_action_hook() #7 {main} thrown in /data/wangzhan/tech.souyunku.com.wp/wp-content/plugins/comet-cache/src/includes/traits/Ac/ObUtils.php on line 367