Browse Source

chore[litemall-core]: 采用yaml配置文件方式

Junling Bu 7 years ago
parent
commit
29751a5f88
42 changed files with 273 additions and 507 deletions
  1. 0 0
      litemall-admin-api/src/main/resources/application-admin.yml
  2. 0 28
      litemall-admin-api/src/main/resources/application-dep.properties
  3. 0 28
      litemall-admin-api/src/main/resources/application-dev.properties
  4. 0 27
      litemall-admin-api/src/main/resources/application-prod.properties
  5. 0 3
      litemall-admin-api/src/main/resources/application.properties
  6. 16 0
      litemall-admin-api/src/main/resources/application.yml
  7. 30 0
      litemall-admin-api/src/test/java/org/linlinjava/litemall/admin/AdminConfigTest.java
  8. 0 37
      litemall-all/src/main/resources/application-dep.properties
  9. 0 37
      litemall-all/src/main/resources/application-dev.properties
  10. 0 36
      litemall-all/src/main/resources/application-prod.properties
  11. 0 2
      litemall-all/src/main/resources/application.properties
  12. 18 0
      litemall-all/src/main/resources/application.yml
  13. 37 0
      litemall-all/src/test/java/org/linlinjava/litemall/allinone/AllinoneConfigTest.java
  14. 0 1
      litemall-core/src/main/java/org/linlinjava/litemall/core/express/config/ExpressConfig.java
  15. 0 0
      litemall-core/src/main/resources/application-core.yml
  16. 0 1
      litemall-core/src/main/resources/application-dep.properties
  17. 0 1
      litemall-core/src/main/resources/application-dev.properties
  18. 0 1
      litemall-core/src/main/resources/application-prod.properties
  19. 0 2
      litemall-core/src/main/resources/application.properties
  20. 12 0
      litemall-core/src/main/resources/application.yml
  21. 29 0
      litemall-core/src/test/java/org/linlinjava/litemall/core/CoreConfigTest.java
  22. 26 0
      litemall-db/src/main/resources/application-db.yml
  23. 0 29
      litemall-db/src/main/resources/application-dep.properties
  24. 0 29
      litemall-db/src/main/resources/application-dev.properties
  25. 0 27
      litemall-db/src/main/resources/application-prod.properties
  26. 0 1
      litemall-db/src/main/resources/application.properties
  27. 12 0
      litemall-db/src/main/resources/application.yml
  28. 22 0
      litemall-db/src/test/java/org/linlinjava/litemall/db/DbConfigTest.java
  29. 0 32
      litemall-os-api/src/main/resources/application-dep.properties
  30. 0 32
      litemall-os-api/src/main/resources/application-dev.properties
  31. 12 0
      litemall-os-api/src/main/resources/application-os.yml
  32. 0 32
      litemall-os-api/src/main/resources/application-prod.properties
  33. 0 10
      litemall-os-api/src/main/resources/application.properties
  34. 16 0
      litemall-os-api/src/main/resources/application.yml
  35. 10 3
      litemall-os-api/src/test/java/org/linlinjava/litemall/os/OsTest.java
  36. 0 34
      litemall-wx-api/src/main/resources/application-dep.properties
  37. 0 34
      litemall-wx-api/src/main/resources/application-dev.properties
  38. 0 34
      litemall-wx-api/src/main/resources/application-prod.properties
  39. 7 0
      litemall-wx-api/src/main/resources/application-wx.yml
  40. 0 3
      litemall-wx-api/src/main/resources/application.properties
  41. 16 0
      litemall-wx-api/src/main/resources/application.yml
  42. 10 3
      litemall-wx-api/src/test/java/org/linlinjava/litemall/wx/WxConfigTest.java

+ 0 - 0
litemall-admin-api/src/main/resources/application-admin.yml


+ 0 - 28
litemall-admin-api/src/main/resources/application-dep.properties

@@ -1,28 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=DEBUG

+ 0 - 28
litemall-admin-api/src/main/resources/application-dev.properties

@@ -1,28 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false&allowPublicKeyRetrieval=true
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=DEBUG

+ 0 - 27
litemall-admin-api/src/main/resources/application-prod.properties

@@ -1,27 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=DEBUG

+ 0 - 3
litemall-admin-api/src/main/resources/application.properties

@@ -1,3 +0,0 @@
-spring.profiles.active=dev
-server.port=8083
-logging.level.org.linlinjava.litemall.admin.Application=DEBUG

+ 16 - 0
litemall-admin-api/src/main/resources/application.yml

@@ -0,0 +1,16 @@
+spring:
+  profiles:
+    active: db, core, admin
+  message:
+    encoding: UTF-8
+
+server:
+  port: 8083
+
+logging:
+  level:
+    root:  ERROR
+    org.springframework:  ERROR
+    org.mybatis:  ERROR
+    org.linlinjava.litemall.admin:  DEBUG
+    org.linlinjava.litemall:  ERROR

+ 30 - 0
litemall-admin-api/src/test/java/org/linlinjava/litemall/admin/AdminConfigTest.java

@@ -0,0 +1,30 @@
+package org.linlinjava.litemall.admin;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.core.env.Environment;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@WebAppConfiguration
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest
+public class AdminConfigTest {
+    @Autowired
+    private Environment environment;
+
+    @Test
+    public void test() {
+        // 测试获取application-core.yml配置信息
+        System.out.println(environment.getProperty("express.appId"));
+        // 测试获取application-db.yml配置信息
+        System.out.println(environment.getProperty("spring.datasource.druid.url"));
+        // 测试获取application-admin.yml配置信息
+        // System.out.println(environment.getProperty(""));
+        // 测试获取application.yml配置信息
+        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.admin"));
+    }
+
+}

+ 0 - 37
litemall-all/src/main/resources/application-dep.properties

@@ -1,37 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall=DEBUG
-
-# 开发者应该设置成自己的域名,必须附带http或者https
-org.linlinjava.litemall.os.address=http://122.152.206.172
-org.linlinjava.litemall.os.port=8080
-
-wx.app-id=wxa5b486c6b918ecfb
-wx.app-secret=e04004829d4c383b4db7769d88dfbca1
-wx.mch-id=
-wx.mch-key=
-wx.notify-url=

+ 0 - 37
litemall-all/src/main/resources/application-dev.properties

@@ -1,37 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall=DEBUG
-
-# 开发者应该设置成自己的域名,必须附带http或者https
-org.linlinjava.litemall.os.address=http://127.0.0.1
-org.linlinjava.litemall.os.port=8080
-
-wx.app-id=wxa5b486c6b918ecfb
-wx.app-secret=e04004829d4c383b4db7769d88dfbca1
-wx.mch-id=
-wx.mch-key=
-wx.notify-url=

+ 0 - 36
litemall-all/src/main/resources/application-prod.properties

@@ -1,36 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall=ERROR
-
-# 开发者应该设置成自己的域名,必须附带http或者https
-org.linlinjava.litemall.os.address=https://www.example.com
-org.linlinjava.litemall.os.port=443
-
-wx.app-id=wxa5b486c6b918ecfb
-wx.app-secret=e04004829d4c383b4db7769d88dfbca1
-wx.mch-id=
-wx.mch-key=
-wx.notify-url=

+ 0 - 2
litemall-all/src/main/resources/application.properties

@@ -1,2 +0,0 @@
-spring.profiles.active=prod
-server.port=8080

+ 18 - 0
litemall-all/src/main/resources/application.yml

@@ -0,0 +1,18 @@
+spring:
+  profiles:
+    active: db, core, admin, wx, os
+  message:
+    encoding: UTF-8
+
+server:
+  port: 8080
+
+logging:
+  level:
+    root:  ERROR
+    org.springframework:  ERROR
+    org.mybatis:  ERROR
+    org.linlinjava.litemall.admin:  DEBUG
+    org.linlinjava.litemall.os:  DEBUG
+    org.linlinjava.litemall.wx:  DEBUG
+    org.linlinjava.litemall:  ERROR

+ 37 - 0
litemall-all/src/test/java/org/linlinjava/litemall/allinone/AllinoneConfigTest.java

@@ -0,0 +1,37 @@
+package org.linlinjava.litemall.allinone;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.core.env.Environment;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@WebAppConfiguration
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest
+public class AllinoneConfigTest {
+    @Autowired
+    private Environment environment;
+
+    @Test
+    public void test() {
+        // 测试获取application-core.yml配置信息
+        System.out.println(environment.getProperty("express.appId"));
+        // 测试获取application-db.yml配置信息
+        System.out.println(environment.getProperty("spring.datasource.druid.url"));
+        // 测试获取application-wx.yml配置信息
+        System.out.println(environment.getProperty("wx.app-id"));
+        // 测试获取application-admin.yml配置信息
+//        System.out.println(environment.getProperty(""));
+        // 测试获取application-os.yml配置信息
+        System.out.println(environment.getProperty("org.linlinjava.litemall.os.address"));
+        // 测试获取application.yml配置信息
+        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.os"));
+        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
+        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.admin"));
+        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall"));
+    }
+
+}

+ 0 - 1
litemall-core/src/main/java/org/linlinjava/litemall/core/express/config/ExpressConfig.java

@@ -12,7 +12,6 @@ import java.util.Map;
 
 @Component
 @Configuration
-@PropertySource(value = {"classpath:application.yaml"}, factory = YmlPropertyFactory.class)
 @ConfigurationProperties(prefix = "express")
 public class ExpressConfig {
     private String appId;

litemall-core/src/main/resources/application.yaml → litemall-core/src/main/resources/application-core.yml


+ 0 - 1
litemall-core/src/main/resources/application-dep.properties

@@ -1 +0,0 @@
-swagger.enable=true

+ 0 - 1
litemall-core/src/main/resources/application-dev.properties

@@ -1 +0,0 @@
-swagger.enable=true

+ 0 - 1
litemall-core/src/main/resources/application-prod.properties

@@ -1 +0,0 @@
-swagger.enable=false

+ 0 - 2
litemall-core/src/main/resources/application.properties

@@ -1,2 +0,0 @@
-spring.profiles.active=dev
-spring.message.encoding = UTF-8  

+ 12 - 0
litemall-core/src/main/resources/application.yml

@@ -0,0 +1,12 @@
+spring:
+  profiles:
+    active: core
+  message:
+    encoding: UTF-8
+
+logging:
+  level:
+    root:  ERROR
+    org.springframework:  ERROR
+    org.mybatis:  ERROR
+    org.linlinjava.litemall.core:  DEBUG

+ 29 - 0
litemall-core/src/test/java/org/linlinjava/litemall/core/CoreConfigTest.java

@@ -0,0 +1,29 @@
+package org.linlinjava.litemall.core;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.linlinjava.litemall.core.express.config.ExpressConfig;
+import org.linlinjava.litemall.core.notify.config.MailNotifyConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.core.env.Environment;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@WebAppConfiguration
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest
+public class CoreConfigTest {
+    @Autowired
+    ExpressConfig config;
+    @Autowired
+    Environment environment;
+
+    @Test
+    public void test() {
+        System.out.println(config.getAppId());
+        System.out.println(config.getAppKey());
+        // 测试获取application-core.yml配置信息
+        System.out.println(environment.getProperty("express.appId"));
+    }
+}

+ 26 - 0
litemall-db/src/main/resources/application-db.yml

@@ -0,0 +1,26 @@
+pagehelper:
+  helperDialect:  mysql
+  reasonable: true
+  supportMethodsArguments:  true
+  params: count=countSql
+
+spring:
+  datasource:
+    druid:
+      url:  jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
+      driver-class-name:  com.mysql.jdbc.Driver
+      username:  litemall
+      password:  litemall123456
+      initial-size:  10
+      max-active:  50
+      min-idle:  10
+      max-wait:  60000
+      pool-prepared-statements:  true
+      max-pool-prepared-statement-per-connection-size:  20
+      validation-query:  SELECT 1 FROM DUAL
+      test-on-borrow:  false
+      test-on-return:  false
+      test-while-idle:  true
+      time-between-eviction-runs-millis:  60000
+      filters:  stat,wall,log4j
+

+ 0 - 29
litemall-db/src/main/resources/application-dep.properties

@@ -1,29 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=DEBUG
-logging.level.org.linlinjava.litemall=ERROR
-

+ 0 - 29
litemall-db/src/main/resources/application-dev.properties

@@ -1,29 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=DEBUG
-logging.level.org.linlinjava.litemall=ERROR
-

+ 0 - 27
litemall-db/src/main/resources/application-prod.properties

@@ -1,27 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=DEBUG
-logging.level.org.linlinjava.litemall=ERROR

+ 0 - 1
litemall-db/src/main/resources/application.properties

@@ -1 +0,0 @@
-spring.profiles.active=dev

+ 12 - 0
litemall-db/src/main/resources/application.yml

@@ -0,0 +1,12 @@
+spring:
+  profiles:
+    active: db
+  message:
+    encoding: UTF-8
+
+logging:
+  level:
+    root:  ERROR
+    org.springframework:  ERROR
+    org.mybatis:  ERROR
+    org.linlinjava.litemall.db:  DEBUG

+ 22 - 0
litemall-db/src/test/java/org/linlinjava/litemall/db/DbConfigTest.java

@@ -0,0 +1,22 @@
+package org.linlinjava.litemall.db;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.core.env.Environment;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@WebAppConfiguration
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest
+public class DbConfigTest {
+    @Autowired
+    Environment environment;
+
+    @Test
+    public void test() {
+        System.out.println(environment.getProperty("spring.datasource.druid.url"));
+    }
+}

+ 0 - 32
litemall-os-api/src/main/resources/application-dep.properties

@@ -1,32 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=ERROR
-
-# 开发者应该设置成自己的域名,必须附带http或者https
-# 开发者可以查看OsStorageController.generateUrl
-org.linlinjava.litemall.os.address=http://122.152.206.172
-org.linlinjava.litemall.os.port=8081

+ 0 - 32
litemall-os-api/src/main/resources/application-dev.properties

@@ -1,32 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false&allowPublicKeyRetrieval=true
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=ERROR
-
-# \u5F00\u53D1\u8005\u5E94\u8BE5\u8BBE\u7F6E\u6210\u81EA\u5DF1\u7684\u57DF\u540D\uFF0C\u5FC5\u987B\u9644\u5E26http\u6216\u8005https
-# \u5F00\u53D1\u8005\u53EF\u4EE5\u67E5\u770BOsStorageController.generateUrl
-org.linlinjava.litemall.os.address=http://127.0.0.1
-org.linlinjava.litemall.os.port=8081

+ 12 - 0
litemall-os-api/src/main/resources/application-os.yml

@@ -0,0 +1,12 @@
+# 当前存储模式
+# los,本地对象存储模式,上传图片保存在服务器中
+# tos,腾讯对象存储模式,上传图片保存在腾讯云存储服务器中,请在tencent.properties配置相关信息
+# tos,阿里云对象存储模式,上传图片保存在腾讯云存储服务器中,请在tencent.properties配置相关信息
+activeStorage: los
+#activeStorage: tos
+#activeStorage: aos
+
+# 开发者应该设置成自己的域名,必须附带http或者https
+# 开发者可以查看OsStorageController.generateUrl
+org.linlinjava.litemall.os.address: http://127.0.0.1
+org.linlinjava.litemall.os.port: 8081

+ 0 - 32
litemall-os-api/src/main/resources/application-prod.properties

@@ -1,32 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=DEBUG
-
-# 开发者应该设置成自己的域名,必须附带http或者https
-# 开发者可以查看OsStorageController.generateUrl
-org.linlinjava.litemall.os.address=https://www.example.com
-org.linlinjava.litemall.os.port=443

+ 0 - 10
litemall-os-api/src/main/resources/application.properties

@@ -1,10 +0,0 @@
-spring.profiles.active=dev
-server.port=8081
-logging.level.org.linlinjava.litemall.os.Application=DEBUG
-
-
-# 当前存储模式
-# los,本地对象存储模式,上传图片保存在服务器中
-# tos,腾讯对象存储模式,上传图片保存在腾讯云存储服务器中,请在tencent.properties配置相关信息
-activeStorage=los
-#activeStorage=tos

+ 16 - 0
litemall-os-api/src/main/resources/application.yml

@@ -0,0 +1,16 @@
+spring:
+  profiles:
+    active: db, core, os
+  message:
+    encoding: UTF-8
+
+server:
+  port: 8081
+
+logging:
+  level:
+    root:  ERROR
+    org.springframework:  ERROR
+    org.mybatis:  ERROR
+    org.linlinjava.litemall.os:  DEBUG
+    org.linlinjava.litemall:  ERROR

+ 10 - 3
litemall-os-api/src/test/java/org/linlinjava/litemall/os/OsTest.java

@@ -2,9 +2,9 @@ package org.linlinjava.litemall.os;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.linlinjava.litemall.os.config.ObjectStorageConfig;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.core.env.Environment;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.test.context.web.WebAppConfiguration;
 
@@ -13,11 +13,18 @@ import org.springframework.test.context.web.WebAppConfiguration;
 @SpringBootTest
 public class OsTest {
     @Autowired
-    private ObjectStorageConfig objectStorageConfig;
+    Environment environment;
 
     @Test
     public void test() {
-        System.out.println(objectStorageConfig.getAddress() + ":" + objectStorageConfig.getPort());
+        // 测试获取application-core.yml配置信息
+        System.out.println(environment.getProperty("express.appId"));
+        // 测试获取application-db.yml配置信息
+        System.out.println(environment.getProperty("spring.datasource.druid.url"));
+        // 测试获取application-os.yml配置信息
+        System.out.println(environment.getProperty("org.linlinjava.litemall.os.address"));
+        // 测试获取application.yml配置信息
+        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.os"));
     }
 
 }

+ 0 - 34
litemall-wx-api/src/main/resources/application-dep.properties

@@ -1,34 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=DEBUG
-
-wx.app-id=wxa5b486c6b918ecfb
-wx.app-secret=e04004829d4c383b4db7769d88dfbca1
-wx.mch-id=
-wx.mch-key=
-wx.notify-url=

+ 0 - 34
litemall-wx-api/src/main/resources/application-dev.properties

@@ -1,34 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false&allowPublicKeyRetrieval=true
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=DEBUG
-
-wx.app-id=wxa5b486c6b918ecfb
-wx.app-secret=e04004829d4c383b4db7769d88dfbca1
-wx.mch-id=
-wx.mch-key=
-wx.notify-url=

+ 0 - 34
litemall-wx-api/src/main/resources/application-prod.properties

@@ -1,34 +0,0 @@
-pagehelper.helperDialect=mysql
-pagehelper.reasonable=true
-pagehelper.supportMethodsArguments=true
-pagehelper.params=count=countSql
-
-spring.datasource.druid.url=jdbc:mysql://localhost:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&verifyServerCertificate=false&useSSL=false
-spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.druid.username=litemall
-spring.datasource.druid.password=litemall123456
-spring.datasource.druid.initial-size=10
-spring.datasource.druid.max-active=50
-spring.datasource.druid.min-idle=10
-spring.datasource.druid.max-wait=60000
-spring.datasource.druid.pool-prepared-statements=true
-spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
-spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
-spring.datasource.druid.test-on-borrow=false
-spring.datasource.druid.test-on-return=false
-spring.datasource.druid.test-while-idle=true
-spring.datasource.druid.time-between-eviction-runs-millis=60000
-spring.datasource.druid.filters=stat,wall,log4j
-
-logging.level.root=ERROR
-logging.level.org.springframework=ERROR
-logging.level.org.mybatis=ERROR
-logging.level.org.linlinjava.litemall.db=ERROR
-logging.level.org.linlinjava.litemall=ERROR
-
-# 开发者应该设置成自己的wx相关信息
-wx.app-id=wxa5b486c6b918ecfb
-wx.app-secret=e04004829d4c383b4db7769d88dfbca1
-wx.mch-id=
-wx.mch-key=
-wx.notify-url=

+ 7 - 0
litemall-wx-api/src/main/resources/application-wx.yml

@@ -0,0 +1,7 @@
+# 开发者应该设置成自己的wx相关信息
+wx:
+  app-id: wxa5b486c6b918ecfb
+  app-secret: e04004829d4c383b4db7769d88dfbca1
+  mch-id: 111111
+  mch-key: xxxxxx
+  notify-url: http://www.example.com/wx/order/pay-notify

+ 0 - 3
litemall-wx-api/src/main/resources/application.properties

@@ -1,3 +0,0 @@
-spring.profiles.active=dev
-server.port=8082
-logging.level.org.linlinjava.litemall.wx.Application=DEBUG

+ 16 - 0
litemall-wx-api/src/main/resources/application.yml

@@ -0,0 +1,16 @@
+spring:
+  profiles:
+    active: db, core, wx
+  message:
+    encoding: UTF-8
+
+server:
+  port: 8082
+
+logging:
+  level:
+    root:  ERROR
+    org.springframework:  ERROR
+    org.mybatis:  ERROR
+    org.linlinjava.litemall.wx:  DEBUG
+    org.linlinjava.litemall:  ERROR

+ 10 - 3
litemall-wx-api/src/test/java/org/linlinjava/litemall/wx/WxConfigTest.java

@@ -6,6 +6,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.core.env.Environment;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.test.context.web.WebAppConfiguration;
 
@@ -14,12 +15,18 @@ import org.springframework.test.context.web.WebAppConfiguration;
 @SpringBootTest
 public class WxConfigTest {
     @Autowired
-    private WxPayService wxPayService;
+    private Environment environment;
 
     @Test
     public void test() {
-        WxPayConfig wxPayConfig = wxPayService.getConfig();
-        System.out.println(wxPayConfig.getMchId() + " " + wxPayConfig.getMchKey());
+        // 测试获取application-core.yml配置信息
+        System.out.println(environment.getProperty("express.appId"));
+        // 测试获取application-db.yml配置信息
+        System.out.println(environment.getProperty("spring.datasource.druid.url"));
+        // 测试获取application-wx.yml配置信息
+        System.out.println(environment.getProperty("wx.app-id"));
+        // 测试获取application.yml配置信息
+        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
     }
 
 }