代码提交

This commit is contained in:
liujing33
2025-05-08 18:02:47 +08:00
parent 55fcc338d7
commit ba04a1047b
60 changed files with 1961 additions and 201 deletions

View File

@@ -0,0 +1,33 @@
<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>com.mangmang</groupId>
<artifactId>spring-cloud-demo</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>eureka-server</artifactId>
<packaging>jar</packaging>
<name>eureka-server</name>
<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-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,17 @@
package com.mangmang;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* 服务注册中心
* 功能:用于服务注册和发现,微服务启动时会向 Eureka 注册自己,并通过 Eureka 发现其他服务
*/
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}

View File

@@ -0,0 +1,21 @@
# server: 配置服务器相关的参数
server:
# port: 指定服务器监听的端口号默认值为8761
port: 8761
# spring: 配置Spring应用相关的参数
spring:
application:
# name: 指定Spring应用的名称这里设置为eureka-server
name: eureka-server
# eureka: 配置Eureka服务器和客户端相关的参数
eureka:
client:
# register-with-eureka: 是否将当前实例注册到Eureka服务器false表示不注册
register-with-eureka: false
# fetch-registry: 是否从Eureka服务器获取注册表信息false表示不获取
fetch-registry: false
server:
# wait-time-in-ms-when-sync-empty: 当同步空注册表时的等待时间毫秒0表示不等待
wait-time-in-ms-when-sync-empty: 0