增加 spring eureka 用例
This commit is contained in:
@ -0,0 +1,64 @@
|
||||
<?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.1.1.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.heibaiying.eurekacluster</groupId>
|
||||
<artifactId>eureka-server</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>eureka-server</name>
|
||||
<description>eureka server project for Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>Finchley.SR2</spring-cloud.version>
|
||||
</properties>
|
||||
|
||||
<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>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
</project>
|
@ -0,0 +1,16 @@
|
||||
package com.heibaiying.eurekacluster.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableEurekaServer
|
||||
public class EurekaServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EurekaServerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
spring:
|
||||
application:
|
||||
name: server
|
||||
server:
|
||||
port: 8010
|
||||
eureka:
|
||||
server:
|
||||
# 关闭自我保护机制 开发的时候可以开启 保证不可用的服务能够及时剔除
|
||||
enable-self-preservation: false
|
||||
instance:
|
||||
hostname: 127.0.0.1
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://localhost:8020/eureka/,http://192.168.200.228:8030/eureka/
|
@ -0,0 +1,14 @@
|
||||
spring:
|
||||
application:
|
||||
name: server
|
||||
server:
|
||||
port: 8020
|
||||
eureka:
|
||||
server:
|
||||
# 关闭自我保护机制 开发的时候可以开启 保证不可用的服务能够及时剔除
|
||||
enable-self-preservation: false
|
||||
instance:
|
||||
hostname: localhost
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://127.0.0.1:8010/eureka/,http://192.168.200.228:8030/eureka/
|
@ -0,0 +1,14 @@
|
||||
spring:
|
||||
application:
|
||||
name: server
|
||||
server:
|
||||
port: 8030
|
||||
eureka:
|
||||
server:
|
||||
# 关闭自我保护机制 开发的时候可以开启 保证不可用的服务能够及时从列表中剔除
|
||||
enable-self-preservation: false
|
||||
instance:
|
||||
hostname: 192.168.200.228
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://127.0.0.1:8010/eureka/,http://localhost:8020/eureka/
|
@ -0,0 +1,17 @@
|
||||
package com.heibaiying.eurekacluster.server;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class EurekaServerApplicationTests {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user