正在显示
6 个修改的文件
包含
144 行增加
和
0 行删除
.gitignore
0 → 100644
| 1 | +HELP.md | ||
| 2 | +/target/ | ||
| 3 | +!.mvn/wrapper/maven-wrapper.jar | ||
| 4 | + | ||
| 5 | +### STS ### | ||
| 6 | +.apt_generated | ||
| 7 | +.classpath | ||
| 8 | +.factorypath | ||
| 9 | +.project | ||
| 10 | +.settings | ||
| 11 | +.springBeans | ||
| 12 | +.sts4-cache | ||
| 13 | + | ||
| 14 | +### IntelliJ IDEA ### | ||
| 15 | +.idea | ||
| 16 | +*.iws | ||
| 17 | +*.iml | ||
| 18 | +*.ipr | ||
| 19 | + | ||
| 20 | +### NetBeans ### | ||
| 21 | +/nbproject/private/ | ||
| 22 | +/nbbuild/ | ||
| 23 | +/dist/ | ||
| 24 | +/nbdist/ | ||
| 25 | +/.nb-gradle/ | ||
| 26 | +/build/ | ||
| 27 | + | ||
| 28 | +### VS Code ### | ||
| 29 | +.vscode/ | 
pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 4 | + <modelVersion>4.0.0</modelVersion> | ||
| 5 | + <parent> | ||
| 6 | + <groupId>org.springframework.boot</groupId> | ||
| 7 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
| 8 | + <version>2.1.3.RELEASE</version> | ||
| 9 | + <relativePath/> <!-- lookup parent from repository --> | ||
| 10 | + </parent> | ||
| 11 | + <groupId>com.tianbo</groupId> | ||
| 12 | + <artifactId>cloud</artifactId> | ||
| 13 | + <version>0.0.1-SNAPSHOT</version> | ||
| 14 | + <name>cloud</name> | ||
| 15 | + <description>Demo project for Spring Boot</description> | ||
| 16 | + | ||
| 17 | + <properties> | ||
| 18 | + <java.version>1.8</java.version> | ||
| 19 | + <spring-cloud.version>Greenwich.BUILD-SNAPSHOT</spring-cloud.version> | ||
| 20 | + </properties> | ||
| 21 | + | ||
| 22 | + <dependencies> | ||
| 23 | + <dependency> | ||
| 24 | + <groupId>org.springframework.boot</groupId> | ||
| 25 | + <artifactId>spring-boot-starter-web</artifactId> | ||
| 26 | + </dependency> | ||
| 27 | + <dependency> | ||
| 28 | + <groupId>org.springframework.cloud</groupId> | ||
| 29 | + <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> | ||
| 30 | + </dependency> | ||
| 31 | + <dependency> | ||
| 32 | + <groupId>org.springframework.boot</groupId> | ||
| 33 | + <artifactId>spring-boot-starter-test</artifactId> | ||
| 34 | + <scope>test</scope> | ||
| 35 | + </dependency> | ||
| 36 | + </dependencies> | ||
| 37 | + | ||
| 38 | + <dependencyManagement> | ||
| 39 | + <dependencies> | ||
| 40 | + <dependency> | ||
| 41 | + <groupId>org.springframework.cloud</groupId> | ||
| 42 | + <artifactId>spring-cloud-dependencies</artifactId> | ||
| 43 | + <version>${spring-cloud.version}</version> | ||
| 44 | + <type>pom</type> | ||
| 45 | + <scope>import</scope> | ||
| 46 | + </dependency> | ||
| 47 | + </dependencies> | ||
| 48 | + </dependencyManagement> | ||
| 49 | + | ||
| 50 | + <build> | ||
| 51 | + <plugins> | ||
| 52 | + <plugin> | ||
| 53 | + <groupId>org.springframework.boot</groupId> | ||
| 54 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 55 | + </plugin> | ||
| 56 | + </plugins> | ||
| 57 | + </build> | ||
| 58 | + | ||
| 59 | +</project> | 
| 1 | +package com.tianbo.cloud; | ||
| 2 | + | ||
| 3 | +import org.springframework.boot.SpringApplication; | ||
| 4 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 5 | +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; | ||
| 6 | + | ||
| 7 | +@SpringBootApplication | ||
| 8 | +@EnableEurekaServer | ||
| 9 | +public class CloudApplication { | ||
| 10 | + | ||
| 11 | + public static void main(String[] args) { | ||
| 12 | + SpringApplication.run(CloudApplication.class, args); | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | +} | 
src/main/resources/application.properties
0 → 100644
| 1 | + | ||
| 2 | +#服务端口 | ||
| 3 | +server.port=19527 | ||
| 4 | +server.servlet.context-path=${SERVER_CONTEXTPATH:} | ||
| 5 | + | ||
| 6 | +#服务名 | ||
| 7 | +spring.application.name=eukekaCenter | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +#springcloud 注册中心服务配置 | ||
| 11 | +eureka.instance.hostname=${spring.cloud.client.ip-address} | ||
| 12 | +eureka.instance.prefer-ip-address=true | ||
| 13 | +eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} | ||
| 14 | + | ||
| 15 | +#表示是否将自己注册到Eureka Server,默认为true。由于当前应用就是Eureka Server,故而设置为false。 | ||
| 16 | +eureka.client.register-with-eureka=false | ||
| 17 | +#表示是否从Eureka Server获取注册信息,默认为true。因为这是一个单点的Eureka Server,不需要同步其他的Eureka Server节点的数据,故而设置为false。 | ||
| 18 | +eureka.client.fetch-registry=false | ||
| 19 | +#eureka注册中心服务器地址,设置与Eureka Server交互的地址,查询服务和注册服务都需要依赖这个地址,多个地址可用逗号(英文的)分割。 | ||
| 20 | +eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/ | ||
| 21 | + | ||
| 22 | +#配置注册中心清理无效节点的时间间隔,默认60000毫秒,即60秒。 | ||
| 23 | +eureka.server.eviction-interval-timer-in-ms=5000 | ||
| 24 | +eureka.server.enable-self-preservation=false | 
| 1 | +package com.tianbo.cloud; | ||
| 2 | + | ||
| 3 | +import org.junit.Test; | ||
| 4 | +import org.junit.runner.RunWith; | ||
| 5 | +import org.springframework.boot.test.context.SpringBootTest; | ||
| 6 | +import org.springframework.test.context.junit4.SpringRunner; | ||
| 7 | + | ||
| 8 | +@RunWith(SpringRunner.class) | ||
| 9 | +@SpringBootTest | ||
| 10 | +public class CloudApplicationTests { | ||
| 11 | + | ||
| 12 | + @Test | ||
| 13 | + public void contextLoads() { | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | +} | 
- 
请 注册 或 登录 后发表评论