浏览代码

初始化提交

gaodd 2 年之前
当前提交
c1998ce9f4
共有 3 个文件被更改,包括 125 次插入0 次删除
  1. 81 0
      pom.xml
  2. 21 0
      src/main/java/com/unis/module/eureka/EurekaApplication.java
  3. 23 0
      src/main/resources/application.yml

+ 81 - 0
pom.xml

@@ -0,0 +1,81 @@
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
+
6
+	<groupId>com.unis.module</groupId>
7
+	<artifactId>depot-eureka-qinghai</artifactId>
8
+	<version>0.0.1-SNAPSHOT</version>
9
+	<packaging>jar</packaging>
10
+
11
+	<name>depot-eureka-qinghai</name>
12
+	<description>Demo project for Spring Boot</description>
13
+
14
+	<parent>
15
+		<groupId>org.springframework.boot</groupId>
16
+		<artifactId>spring-boot-starter-parent</artifactId>
17
+		<version>2.0.3.RELEASE</version>
18
+		<relativePath/> <!-- lookup parent from repository -->
19
+	</parent>
20
+
21
+	<properties>
22
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23
+		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24
+		<java.version>1.8</java.version>
25
+		<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
26
+	</properties>
27
+
28
+	<dependencies>
29
+		<dependency>
30
+			<groupId>org.springframework.cloud</groupId>
31
+			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
32
+		</dependency>
33
+
34
+		<dependency>
35
+			<groupId>org.springframework.boot</groupId>
36
+			<artifactId>spring-boot-starter-test</artifactId>
37
+			<scope>test</scope>
38
+		</dependency>
39
+	</dependencies>
40
+
41
+	<dependencyManagement>
42
+		<dependencies>
43
+			<dependency>
44
+				<groupId>org.springframework.cloud</groupId>
45
+				<artifactId>spring-cloud-dependencies</artifactId>
46
+				<version>${spring-cloud.version}</version>
47
+				<type>pom</type>
48
+				<scope>import</scope>
49
+			</dependency>
50
+		</dependencies>
51
+	</dependencyManagement>
52
+
53
+	<build>
54
+		<plugins>
55
+			<plugin>
56
+				<groupId>org.springframework.boot</groupId>
57
+				<artifactId>spring-boot-maven-plugin</artifactId>
58
+				<!--第一次打包时需要注释到 configuration 节点,因为我们要得到全部的jar包-->
59
+ 				<!--<configuration>
60
+					<layout>ZIP</layout>
61
+					<includes>
62
+						<include>
63
+							<groupId>com.unis.module</groupId>
64
+							<artifactId>eureka</artifactId>
65
+						</include>
66
+					</includes>
67
+				</configuration>-->
68
+			</plugin>
69
+			<!--打包时不进行验证测试-->
70
+			<plugin>
71
+				<groupId>org.apache.maven.plugins</groupId>
72
+				<artifactId>maven-surefire-plugin</artifactId>
73
+				<version>2.21.0</version>
74
+				<configuration>
75
+					<skipTests>true</skipTests>
76
+				</configuration>
77
+			</plugin>
78
+		</plugins>
79
+		<finalName>${project.artifactId}</finalName>
80
+	</build>
81
+</project>

+ 21 - 0
src/main/java/com/unis/module/eureka/EurekaApplication.java

@@ -0,0 +1,21 @@
1
+package com.unis.module.eureka;
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
+/**
8
+ * TODO 功能描述:服务注册中心
9
+ *
10
+ * @author 李兵
11
+ * @version v1.0
12
+ * @date 2018/6/29 11:08
13
+ */
14
+@SpringBootApplication
15
+@EnableEurekaServer
16
+public class EurekaApplication {
17
+
18
+    public static void main(String[] args) {
19
+        SpringApplication.run(EurekaApplication.class, args);
20
+    }
21
+}

+ 23 - 0
src/main/resources/application.yml

@@ -0,0 +1,23 @@
1
+server:
2
+  port: 9001
3
+
4
+eureka:
5
+  instance:
6
+    prefer-ip-address: true
7
+    # 仅测试使用,部署上线不使用
8
+    status-page-url-path: /swagger-ui.html
9
+  client:
10
+    register-with-eureka: false
11
+    fetch-registry: false
12
+    service-url:
13
+      defaultZone: http://172.16.0.16:9001/eureka/
14
+  server:
15
+    # 关闭自我保护机制(不关闭会在所有服务连接异常85%后不在注销服务)
16
+    enable-self-preservation: false
17
+    # 每隔30s扫描服务列表,移除失效服务(默认60000)
18
+    eviction-interval-timer-in-ms: 30000
19
+management:
20
+  endpoints:
21
+    web:
22
+      exposure:
23
+        include: '*'