Commit 29751a5f authored by Junling Bu's avatar Junling Bu
Browse files

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

parent ef999d86
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"));
}
}
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
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
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
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
\ No newline at end of file
spring.profiles.active=dev
\ No newline at end of file
spring:
profiles:
active: db
message:
encoding: UTF-8
logging:
level:
root: ERROR
org.springframework: ERROR
org.mybatis: ERROR
org.linlinjava.litemall.db: DEBUG
\ No newline at end of file
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"));
}
}
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
\ No newline at end of file
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
\ No newline at end of file
spring.profiles.active=dev
server.port=8081
logging.level.org.linlinjava.litemall.os.Application=DEBUG
# 当前存储模式
# los,本地对象存储模式,上传图片保存在服务器中
# tos,腾讯对象存储模式,上传图片保存在腾讯云存储服务器中,请在tencent.properties配置相关信息
activeStorage=los
#activeStorage=tos
# 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
\ No newline at end of file
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
\ No newline at end of file
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
\ No newline at end of file
......@@ -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"));
}
}
\ No newline at end of file
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=
\ No newline at end of file
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=
\ No newline at end of file
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=
\ No newline at end of file
# 开发者应该设置成自己的wx相关信息
wx:
app-id: wxa5b486c6b918ecfb
app-secret: e04004829d4c383b4db7769d88dfbca1
mch-id: 111111
mch-key: xxxxxx
notify-url: http://www.example.com/wx/order/pay-notify
\ No newline at end of file
spring.profiles.active=dev
server.port=8082
logging.level.org.linlinjava.litemall.wx.Application=DEBUG
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
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment