Explorar o código

拆分测试环境配置

wuhongshuang %!s(int64=3) %!d(string=hai) anos
pai
achega
b33f78b85a
Modificáronse 3 ficheiros con 49 adicións e 39 borrados
  1. 1 1
      pom.xml
  2. 1 1
      src/main/java/com/szwl/Application.java
  3. 47 37
      src/main/resources/bootstrap.yml

+ 1 - 1
pom.xml

@@ -246,7 +246,7 @@
 		</repository>
 		<repository>
 			<id>nexus</id>
-			<url>http://www.redouble.store:1888/repository/crbank-host/</url>
+			<url>http://120.25.151.99:1888/repository/crbank-host/</url>
 			<releases>
 				<enabled>true</enabled>
 			</releases>

+ 1 - 1
src/main/java/com/szwl/Application.java

@@ -6,10 +6,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 
-@SpringBootApplication
 @EnableEurekaClient
 @EnableFeignClients
 @MapperScan("com.szwl.mapper")
+@SpringBootApplication(scanBasePackages = {"com.szwl", "cn.com.crbank.ommo.exception","cn.com.crbank.ommo.esclient"})
 public class Application{
     public static void main(String[] args) {
         SpringApplication.run(Application.class, args);

+ 47 - 37
src/main/resources/bootstrap.yml

@@ -1,41 +1,17 @@
 spring:
   application:
     name: pay-server
+  profiles:
+    # 打包或运行时,换这里:sit测试,prod正式
+    active: sit
   cloud:
     config:
       name: pay-server
       discovery:
         service-id: config-server
         # 是否获取配置中心配置
-        enabled: false
-  datasource:
-    url: jdbc:mysql://rm-wz995mu26a1479kz0so.mysql.rds.aliyuncs.com:3306/szwl
-    username: root
-    password: sunzee@020
-    driver-class-name: com.mysql.jdbc.Driver
-  rabbitmq:
-    addresses: 112.74.63.148:5672,120.78.140.173:5672,47.112.127.131:5672
-    username: zwlzwlzwl
-    password: 123456
-    virtual-host: /
-#    publisher-confirms: true
-    connection-timeout: 5s
-    mandatory: true
-    template.mandatory: true
-    publisher-returns: true
-    cache.channel.size: 1000
-    concurrency: 500
-    max-concurrency: 2000
-    listener.simple.concurrency: 1000
-    listener.simple.max-concurrency: 2000
-elasticSearch:
-  host: 120.78.140.173
-#elasticSearch.host: 10.0.0.155
-  port: 9200
-  client.connectNum: 1000
-  connectPerRoute: 50
-  client.esUserName: elastic
-  client.esPassword: sunzee@020
+        enabled: true
+# 项目端口
 server:
   port: 49013
 
@@ -44,14 +20,6 @@ management:
     web:
       exposure:
         include: refresh
-eureka:
-  client:
-    service-url:
-      defaultZone: http://112.74.63.148:49001/eureka/
-    register-with-eureka: true
-  instance:
-    prefer-ip-address: true
-#    ip-address: 10.241.20.241
 
 mybatis-plus:
   mapper-locations: classpath:com/szwl/mapper/xml/*.xml
@@ -60,3 +28,45 @@ logging:
   level:
     com.szwl: debug
 
+##上面是基础配置,不用上配置中心那种
+##下面是环境区分,主要不同环境不同文件获取
+---
+#测试环境
+spring:
+  profiles: sit
+  #数据库配置
+  datasource:
+    url: jdbc:mysql://rm-wz995mu26a1479kz0so.mysql.rds.aliyuncs.com:3306/szwl-test
+    username: root
+    password: sunzee@020
+    driver-class-name: com.mysql.jdbc.Driver
+
+#注册中心
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://120.25.151.99:49001/eureka/
+    register-with-eureka: true
+  instance:
+    prefer-ip-address: true
+    ip-address: 120.25.151.99
+
+---
+##正式环境
+spring:
+  profiles: prod
+  #数据库配置
+  datasource:
+    url: jdbc:mysql://rm-wz995mu26a1479kz0so.mysql.rds.aliyuncs.com:3306/szwl
+    username: root
+    password: sunzee@020
+    driver-class-name: com.mysql.jdbc.Driver
+
+#注册中心
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://112.74.63.148:49001/eureka/
+    register-with-eureka: true
+  instance:
+    prefer-ip-address: true