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

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

parent ef999d86
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
\ 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
\ 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
\ No newline at end of file
spring.profiles.active=dev
server.port=8083
logging.level.org.linlinjava.litemall.admin.Application=DEBUG
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
\ No newline at end of file
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"));
}
}
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=
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=
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=
\ No newline at end of file
spring.profiles.active=prod
server.port=8080
\ No newline at end of file
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
\ No newline at end of file
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"));
}
}
......@@ -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;
......
swagger.enable=true
\ No newline at end of file
swagger.enable=true
\ No newline at end of file
swagger.enable=false
\ No newline at end of file
spring.profiles.active=dev
spring.message.encoding = UTF-8
\ No newline at end of file
spring:
profiles:
active: core
message:
encoding: UTF-8
logging:
level:
root: ERROR
org.springframework: ERROR
org.mybatis: ERROR
org.linlinjava.litemall.core: DEBUG
\ 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