eureka-center 注册中心

master
王兵 4 years ago
parent 4ca4a01816
commit 3d21692136

31
.gitignore vendored

@ -1,6 +1,25 @@
target/ /target/
pom.xml.tag !.mvn/wrapper/maven-wrapper.jar
pom.xml.releaseBackup
pom.xml.versionsBackup ### STS ###
pom.xml.next .apt_generated
release.properties .classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

@ -0,0 +1,87 @@
<?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.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>xyz.wbsite</groupId>
<artifactId>eureka-center</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>eureka-center</name>
<description>eureka-center</description>
<properties>
<java.version>1.8</java.version>
<maven.test.skip>true</maven.test.skip>
</properties>
<repositories>
<!-- 常用公共仓库 阿里云镜像 -->
<repository>
<id>public</id>
<name>central仓和jcenter仓的聚合仓</name>
<layout>default</layout>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
</repository>
<repository>
<id>google</id>
<name>google仓</name>
<layout>default</layout>
<url>https://maven.aliyun.com/repository/google</url>
</repository>
<repository>
<id>spring</id>
<name>spring仓</name>
<layout>default</layout>
<url>https://maven.aliyun.com/repository/spring</url>
</repository>
<repository>
<id>spring-plugin</id>
<name>spring-plugin仓</name>
<layout>default</layout>
<url>https://maven.aliyun.com/repository/spring-plugin</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- 项目名称 -->
<finalName>eureka-center</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>*.bat</include>
</includes>
<targetPath>${project.basedir}/target</targetPath>
</resource>
</resources>
</build>
</project>

@ -0,0 +1,16 @@
package xyz.wbsite;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaCenterApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaCenterApplication.class, args);
}
}

@ -0,0 +1,16 @@
# 服务端口
server.port=18080
# 应用名称
spring.application.name=eureka-center
# 实例主机名
eureka.instance.hostname=eureka-center
# 是否注册自己,自己是注册中心所以不用注册自己
eureka.client.register-with-eureka=false
# 是否查找服务,自己是注册中心所以不用其他地址
eureka.client.fetch-registry=false
# 高可用容灾配置,可配置多个注册中心,逗号隔开,默认指向自己,因端口变更显示声明地址
eureka.client.service-url.defaultZone=http://127.0.0.1:18080/eureka/
# 是否启用控制台
eureka.dashboard.enabled=true
# 控制台路径
eureka.dashboard.path=/

@ -0,0 +1,3 @@
@echo off
cd %cd%
start java -jar eureka-center.jar --spring.profiles.active=''

@ -0,0 +1,17 @@
package xyz.wbsite;
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 EurekaCenterApplicationTests {
@Test
public void contextLoads() {
}
}
Loading…
Cancel
Save

Powered by TurnKey Linux.