1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

(没成功,放弃尝试)去除注册中心 nacos;添加 Eureka;升级Spring Cloud版本为2022.0.1;JDK版本为17

This commit is contained in:
2023-03-01 17:24:31 +08:00
parent 0f43fa20b6
commit b7d2a5efd4
25 changed files with 154 additions and 103 deletions

View File

@@ -0,0 +1,43 @@
<?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">
<!--<parent>-->
<!-- <artifactId>spring-boot-starter-parent</artifactId>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <version>3.0.2</version>-->
<!--</parent>-->
<modelVersion>4.0.0</modelVersion>
<groupId>com.cxyxiaomo</groupId>
<artifactId>microservice-eureka-server-8761</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>microservice-eureka-server</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<!-- Spring Cloud Dependencies -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2022.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,13 @@
package com.cxyxiaomo.epp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApp {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApp.class, args);
}
}

View File

@@ -0,0 +1,16 @@
server:
port: 8761
eureka:
instance:
hostname: localhost
client:
register-with-eureka: false # 是否向注册中心注册自己
fetch-registry: false # false表示自己端就是注册中心我的职责就是维护服务实例并不需要去检索服务
# 以上两个配置只需要在单机版配置,集群版不需要配这两个
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
spring:
application:
name: microservice-eureka-server

View File

@@ -0,0 +1,12 @@
package com.epp;
/**
* Unit test for simple App.
*/
public class AppTest {
/**
* Rigorous Test :-)
*/
public void shouldAnswerWithTrue() {
}
}