傅行帆 5 years ago
parent
commit
71f5eca656

+ 33
- 0
pom.xml View File

@@ -93,6 +93,29 @@
93 93
 		</dependency>
94 94
 	</dependencies>
95 95
 
96
+	<profiles>
97
+		<profile>
98
+			<id>dev</id>
99
+			<activation>
100
+				<activeByDefault>true</activeByDefault>
101
+			</activation>
102
+			<properties>
103
+				<profiles.active>dev</profiles.active>
104
+			</properties>
105
+		</profile>
106
+		<profile>
107
+			<id>test</id>
108
+			<properties>
109
+				<profiles.active>test</profiles.active>
110
+			</properties>
111
+		</profile>
112
+		<profile>
113
+			<id>prod</id>
114
+			<properties>
115
+				<profiles.active>prod</profiles.active>
116
+			</properties>
117
+		</profile>
118
+	</profiles>
96 119
 	<build>
97 120
 		<plugins>
98 121
 			<plugin>
@@ -100,6 +123,16 @@
100 123
 				<artifactId>spring-boot-maven-plugin</artifactId>
101 124
 			</plugin>
102 125
 		</plugins>
126
+		<resources>
127
+			<resource>
128
+				<directory>src/main/resources</directory>
129
+				<filtering>true</filtering>
130
+				<includes>
131
+					<include>application.yml</include>
132
+					<include>application-${profiles.active}.yml</include>
133
+				</includes>
134
+			</resource>
135
+		</resources>
103 136
 	</build>
104 137
 
105 138
 </project>

+ 51
- 0
src/main/resources/application-dev.yml View File

@@ -0,0 +1,51 @@
1
+server:
2
+  port: 8080
3
+spring:
4
+  application:
5
+    name: estateagents
6
+  datasource:
7
+    username: estateagents
8
+    password: DQ@0lW##kBb2+-jPZ
9
+    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/estateagents?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
+    driver-class-name: com.mysql.cj.jdbc.Driver
11
+    initial-size: 10 # 初始化连接数
12
+    max-active: 20 # 最大连接数
13
+    min-idle: 8 # 最小空闲数
14
+    max-idle: 8 # 最大空闲数
15
+  servlet:
16
+    multipart:
17
+      max-file-size: 10MB
18
+      max-request-size: 50MB
19
+
20
+##mybatis-plus
21
+mybatis-plus:
22
+  configuration:
23
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
24
+    call-setters-on-nulls: true
25
+  mapper-locations: classpath:mapper/*.xml
26
+wx:
27
+  miniapp:
28
+    appid: wxd6f47a9bb3052175
29
+    secret: 28f33b6bbc0f778c11a0bb234a7d6d4e
30
+    token:
31
+    aesKey:
32
+    msgDataFormat: JSON
33
+  tpls:
34
+    - name: notice
35
+      id: 6hWKexNlaVpAOvrcWxHHQ_Duz1gRIkg2-Clsktp2-Os
36
+      keywords: 4
37
+    - name: newCustomer
38
+      id: WiBYjqkE9KvwDv1WSq5vnuv5A6FSaOB8ETFcrVmtCEI
39
+      keywords: 4
40
+    - name: mainbiz
41
+      id: WiBYjqkE9KvwDv1WSq5vniGU4P0gvwlat-5ENYKpfxg
42
+      keywords: 6
43
+ali:
44
+  accessKeyId: LTAIkc75dpkJw8Lb
45
+  accessKeySecret: v4bvXCaix6vSDTCFfwSAdqV53iFEQw
46
+  oss:
47
+    endpoint: oss-cn-shanghai.aliyuncs.com
48
+    bucketName: estateagents
49
+    bucketURL: https://estateagents.oss-cn-shanghai.aliyuncs.com
50
+
51
+

+ 51
- 0
src/main/resources/application-prod.yml View File

@@ -0,0 +1,51 @@
1
+server:
2
+  port: 8080
3
+spring:
4
+  application:
5
+    name: estateagents
6
+  datasource:
7
+    username: estateagents
8
+    password: DQ@0lW##kBb2+-jPZ
9
+    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/estateagents?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
+    driver-class-name: com.mysql.cj.jdbc.Driver
11
+    initial-size: 10 # 初始化连接数
12
+    max-active: 20 # 最大连接数
13
+    min-idle: 8 # 最小空闲数
14
+    max-idle: 8 # 最大空闲数
15
+  servlet:
16
+    multipart:
17
+      max-file-size: 10MB
18
+      max-request-size: 50MB
19
+
20
+##mybatis-plus
21
+mybatis-plus:
22
+  configuration:
23
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
24
+    call-setters-on-nulls: true
25
+  mapper-locations: classpath:mapper/*.xml
26
+wx:
27
+  miniapp:
28
+    appid: wxd6f47a9bb3052175
29
+    secret: 28f33b6bbc0f778c11a0bb234a7d6d4e
30
+    token:
31
+    aesKey:
32
+    msgDataFormat: JSON
33
+  tpls:
34
+    - name: notice
35
+      id: 6hWKexNlaVpAOvrcWxHHQ_Duz1gRIkg2-Clsktp2-Os
36
+      keywords: 4
37
+    - name: newCustomer
38
+      id: WiBYjqkE9KvwDv1WSq5vnuv5A6FSaOB8ETFcrVmtCEI
39
+      keywords: 4
40
+    - name: mainbiz
41
+      id: WiBYjqkE9KvwDv1WSq5vniGU4P0gvwlat-5ENYKpfxg
42
+      keywords: 6
43
+ali:
44
+  accessKeyId: LTAIkc75dpkJw8Lb
45
+  accessKeySecret: v4bvXCaix6vSDTCFfwSAdqV53iFEQw
46
+  oss:
47
+    endpoint: oss-cn-shanghai.aliyuncs.com
48
+    bucketName: estateagents
49
+    bucketURL: https://estateagents.oss-cn-shanghai.aliyuncs.com
50
+
51
+

+ 51
- 0
src/main/resources/application-test.yml View File

@@ -0,0 +1,51 @@
1
+server:
2
+  port: 8080
3
+spring:
4
+  application:
5
+    name: estateagents
6
+  datasource:
7
+    username: estateagents
8
+    password: DQ@0lW##kBb2+-jPZ
9
+    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/estateagents?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
+    driver-class-name: com.mysql.cj.jdbc.Driver
11
+    initial-size: 10 # 初始化连接数
12
+    max-active: 20 # 最大连接数
13
+    min-idle: 8 # 最小空闲数
14
+    max-idle: 8 # 最大空闲数
15
+  servlet:
16
+    multipart:
17
+      max-file-size: 10MB
18
+      max-request-size: 50MB
19
+
20
+##mybatis-plus
21
+mybatis-plus:
22
+  configuration:
23
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
24
+    call-setters-on-nulls: true
25
+  mapper-locations: classpath:mapper/*.xml
26
+wx:
27
+  miniapp:
28
+    appid: wxd6f47a9bb3052175
29
+    secret: 28f33b6bbc0f778c11a0bb234a7d6d4e
30
+    token:
31
+    aesKey:
32
+    msgDataFormat: JSON
33
+  tpls:
34
+    - name: notice
35
+      id: 6hWKexNlaVpAOvrcWxHHQ_Duz1gRIkg2-Clsktp2-Os
36
+      keywords: 4
37
+    - name: newCustomer
38
+      id: WiBYjqkE9KvwDv1WSq5vnuv5A6FSaOB8ETFcrVmtCEI
39
+      keywords: 4
40
+    - name: mainbiz
41
+      id: WiBYjqkE9KvwDv1WSq5vniGU4P0gvwlat-5ENYKpfxg
42
+      keywords: 6
43
+ali:
44
+  accessKeyId: LTAIkc75dpkJw8Lb
45
+  accessKeySecret: v4bvXCaix6vSDTCFfwSAdqV53iFEQw
46
+  oss:
47
+    endpoint: oss-cn-shanghai.aliyuncs.com
48
+    bucketName: estateagents
49
+    bucketURL: https://estateagents.oss-cn-shanghai.aliyuncs.com
50
+
51
+

+ 2
- 50
src/main/resources/application.yml View File

@@ -1,51 +1,3 @@
1
-server:
2
-  port: 8080
3 1
 spring:
4
-  application:
5
-    name: estateagents
6
-  datasource:
7
-    username: estateagents
8
-    password: DQ@0lW##kBb2+-jPZ
9
-    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/estateagents?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
-    driver-class-name: com.mysql.cj.jdbc.Driver
11
-    initial-size: 10 # 初始化连接数
12
-    max-active: 20 # 最大连接数
13
-    min-idle: 8 # 最小空闲数
14
-    max-idle: 8 # 最大空闲数
15
-  servlet:
16
-    multipart:
17
-      max-file-size: 10MB
18
-      max-request-size: 50MB
19
-
20
-##mybatis-plus
21
-mybatis-plus:
22
-  configuration:
23
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
24
-    call-setters-on-nulls: true
25
-  mapper-locations: classpath:mapper/*.xml
26
-wx:
27
-  miniapp:
28
-    appid: wxd6f47a9bb3052175
29
-    secret: 28f33b6bbc0f778c11a0bb234a7d6d4e
30
-    token:
31
-    aesKey:
32
-    msgDataFormat: JSON
33
-  tpls:
34
-    - name: notice
35
-      id: 6hWKexNlaVpAOvrcWxHHQ_Duz1gRIkg2-Clsktp2-Os
36
-      keywords: 4
37
-    - name: newCustomer
38
-      id: WiBYjqkE9KvwDv1WSq5vnuv5A6FSaOB8ETFcrVmtCEI
39
-      keywords: 4
40
-    - name: mainbiz
41
-      id: WiBYjqkE9KvwDv1WSq5vniGU4P0gvwlat-5ENYKpfxg
42
-      keywords: 6
43
-ali:
44
-  accessKeyId: LTAIkc75dpkJw8Lb
45
-  accessKeySecret: v4bvXCaix6vSDTCFfwSAdqV53iFEQw
46
-  oss:
47
-    endpoint: oss-cn-shanghai.aliyuncs.com
48
-    bucketName: estateagents
49
-    bucketURL: https://estateagents.oss-cn-shanghai.aliyuncs.com
50
-
51
-
2
+  profiles:
3
+    active: @profiles.active@