소스 검색

设备配置

gaodandan 7 년 전
부모
커밋
981a2bc273
5개의 변경된 파일38개의 추가작업 그리고 17개의 파일을 삭제
  1. 5 0
      Dockerfile
  2. 6 2
      pom.xml
  3. 2 0
      src/main/java/com/chinaitop/depot/DepotDeviceApplication.java
  4. 0 15
      src/main/resources/application.properties
  5. 25 0
      src/main/resources/bootstrap.yml

+ 5 - 0
Dockerfile

@@ -0,0 +1,5 @@
1
+FROM 192.168.123.25:31104/unis/java:8
2
+ 
3
+ADD ./target/depot-device.jar /root
4
+CMD ["sh", "-c", "cd /root; java -Djava.security.egd=file:/dev/./urandom -jar /root/depot-device.jar --depot-device.server.enable-self-preservation=false"]
5
+EXPOSE 9005

+ 6 - 2
pom.xml

@@ -6,7 +6,7 @@
6 6
 	<groupId>com.chinaitop</groupId>
7 7
 	<artifactId>depot-device</artifactId>
8 8
 	<version>0.0.1-SNAPSHOT</version>
9
-	<packaging>war</packaging>
9
+	<packaging>jar</packaging>
10 10
 
11 11
 	<name>depot-device</name>
12 12
 	<description>Demo project for Spring Boot</description>
@@ -45,7 +45,10 @@
45 45
 			<groupId>org.springframework.cloud</groupId>
46 46
 			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
47 47
 		</dependency>
48
-
48
+		<dependency>
49
+            <groupId>org.springframework.cloud</groupId>
50
+            <artifactId>spring-cloud-starter-config</artifactId>
51
+        </dependency>
49 52
 		<dependency>
50 53
 			<groupId>org.apache.commons</groupId>
51 54
 			<artifactId>commons-lang3</artifactId>
@@ -101,6 +104,7 @@
101 104
 	</dependencyManagement>
102 105
 
103 106
 	<build>
107
+	    <finalName>${project.artifactId}</finalName>
104 108
 		<plugins>
105 109
 			<plugin>
106 110
 				<groupId>org.springframework.boot</groupId>

+ 2 - 0
src/main/java/com/chinaitop/depot/DepotDeviceApplication.java

@@ -3,9 +3,11 @@ package com.chinaitop.depot;
3 3
 import org.mybatis.spring.annotation.MapperScan;
4 4
 import org.springframework.boot.SpringApplication;
5 5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
6
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 7
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 8
 
8 9
 @EnableEurekaClient
10
+@EnableDiscoveryClient
9 11
 @SpringBootApplication
10 12
 @MapperScan(basePackages = {"com.chinaitop.depot.*.mapper"})
11 13
 public class DepotDeviceApplication {

+ 0 - 15
src/main/resources/application.properties

@@ -1,15 +0,0 @@
1
-server.port=9005
2
-
3
-# 配置库级应用数据源
4
-spring.datasource.driverClassName = com.mysql.jdbc.Driver
5
-spring.datasource.url = jdbc:mysql://192.168.80.25:3306/depot?useUnicode=true&characterEncoding=utf-8
6
-spring.datasource.username = root
7
-spring.datasource.password = 123456
8
-
9
-eureka.client.serviceUrl.defaultZone=http://localhost:9001/eureka/
10
-spring.application.name=depot-device
11
-
12
-eureka.instance.status-page-url=http://localhost:${server.port}/swagger-ui.html
13
-
14
-#服务器图片保存位置
15
-web.upload-path=D:/depotImg/

+ 25 - 0
src/main/resources/bootstrap.yml

@@ -0,0 +1,25 @@
1
+server:
2
+  port: 9005
3
+  tomcat:
4
+    uri-encoding: utf-8
5
+ 
6
+# 注册中心配置
7
+eureka:
8
+  client:
9
+    service-url:
10
+      defaultZone: http://eureka-depot:9001/eureka/
11
+  instance:
12
+    prefer-ip-address: true
13
+ 
14
+spring:
15
+  application:
16
+    name: depot-device
17
+  #配置中心配置
18
+  cloud:
19
+    config:
20
+      #使用discovery 时需要将eureka 写到该文件中,开发环境使用该方式,推荐使用。
21
+      discovery:
22
+        enabled: true
23
+        service-id: depot-config-server
24
+      profile: dev
25
+      label: master