1. 分离测试环境,运行环境配置信息

This commit is contained in:
黄昕 2024-03-22 16:06:10 +08:00
parent 89e6e7309c
commit 430ea0e1ad
10 changed files with 118 additions and 209 deletions

View File

@ -0,0 +1,98 @@
server :
port : 9276
servlet :
context-path: /cmhi
compression:
# 开启响应压缩
enabled : true
mime-types :
- application/json # RESTful API JSON
# 进行压缩的最小体积
min-response-size: 1KB
# Crypto Configure
jasypt :
encryptor:
algorithm: PBEWITHHMACSHA512ANDAES_256
password :
spring :
mvc :
throw-exception-if-no-handler-found: true
web :
resources:
add-mappings: false
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
dbcp2 :
max-total : 128
max-wait-millis : 10000
max-idle : 32
min-idle : 8
initial-size : 8
validation-query : SELECT 1
test-while-idle : true
connection-properties:
characterEncoding: utf8
jackson :
date-format : yyyy-MM-dd HH:mm:ss.SSS
timezone : GMT+8
default-property-inclusion: non_null
mapper :
default-view-inclusion: true
deserialization :
fail-on-unknown-properties: false
sql :
init:
encoding: utf8
# ALWAYS/EMBEDDED/NEVER
mode : always
enabled : true
#mybatis
mybatis :
mapper-locations : classpath*:mappers/*.xml
type-aliases-package: com.cf.cs.database.pojo.entry
configuration :
default-enum-type-handler: com.cf.cs.database.common.DataBaseEnumHandler
mybatis-flex:
global-config:
print-banner: false
#pagehelper
pagehelper :
helper-dialect : mysql
reasonable : true
support-methods-arguments: true
pageSizeZero : true
params.count : countSql
log4j :
logger:
org:
mybatis: info
# swagger-ui custom path
springdoc :
swagger-ui:
path: /swagger-ui.html
# JWT configure
jwt :
http-head : Authorization
secret-key : MTIzNDU2Nzg=
expire-time: 604800
# 字典配置
system :
dict:
raw-value : true
cache :
enabled: true
controller:
enabled: false
prefix : /dict

View File

@ -1,115 +1,18 @@
server :
port : 9276
servlet :
context-path: /cmhi
compression:
# 开启响应压缩
enabled : true
mime-types :
- application/json # RESTful API JSON
# 进行压缩的最小体积
min-response-size: 1KB
# Crypto Configure
jasypt :
encryptor:
algorithm: PBEWITHHMACSHA512ANDAES_256
password :
spring :
mvc :
throw-exception-if-no-handler-found: true
web :
resources:
add-mappings: false
jackson :
date-format : yyyy-MM-dd HH:mm:ss.SSS
timezone : GMT+8
default-property-inclusion: non_null
mapper :
default-view-inclusion: true
deserialization :
fail-on-unknown-properties: false
datasource:
#url : jdbc:mysql://xajhuang.com:3307/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
url : jdbc:mysql://localhost:3306/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
driver-class-name: com.mysql.cj.jdbc.Driver
#username : xajhuang
#password : wkj!nky5cjb!GMV6guq
username : root
password : aaaHuang1
dbcp2 :
max-total : 128
max-wait-millis : 10000
max-idle : 32
min-idle : 8
initial-size : 8
validation-query : SELECT 1
test-while-idle : true
connection-properties:
characterEncoding: utf8
spring :
sql :
init:
encoding : utf8
schema-locations: file:config/rbac/schema.sql
data-locations : file:config/rbac/data.sql
# ALWAYS/EMBEDDED/NEVER
mode : always
enabled : true
#mybatis
mybatis :
mapper-locations : classpath*:mappers/*.xml
type-aliases-package: com.cf.cs.database.pojo.entry
configuration :
default-enum-type-handler: com.cf.cs.database.common.DataBaseEnumHandler
mybatis-flex:
global-config:
print-banner: false
#pagehelper
pagehelper :
helper-dialect : mysql
reasonable : true
support-methods-arguments: true
pageSizeZero : true
params.count : countSql
datasource:
url : jdbc:mysql://localhost:3306/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
username: root
password: aaaHuang1
#config log
logging :
logging:
config: file:config/logback.xml
log4j :
logger:
org:
mybatis: info
# swagger-ui custom path
springdoc :
swagger-ui:
path: /swagger-ui.html
# JWT configure
jwt :
http-head : Authorization
secret-key : MTIzNDU2Nzg=
expire-time: 604800
# 字典配置
system :
dict:
raw-value : true
cache :
enabled: true
controller:
enabled: false
prefix : /dict
casbin:
model-path: config/casbin/model.conf
casbin :
model-path : config/casbin/model.conf
policy-path: config/casbin/policy.csv

View File

@ -1,36 +1,8 @@
server :
port : 9276
servlet :
context-path: /cmhi
compression:
# 开启响应压缩
enabled : true
mime-types :
- application/json # RESTful API JSON
# 进行压缩的最小体积
min-response-size: 1KB
# Crypto Configure
jasypt :
encryptor:
algorithm: PBEWITHHMACSHA512ANDAES_256
password :
spring :
mvc :
throw-exception-if-no-handler-found: true
web :
resources:
add-mappings: false
jackson :
date-format : yyyy-MM-dd HH:mm:ss.SSS
timezone : GMT+8
default-property-inclusion: non_null
mapper :
default-view-inclusion: true
deserialization :
fail-on-unknown-properties: false
sql:
init:
schema-locations: file:../config/rbac/schema.sql
data-locations : file:../config/rbac/data.sql
datasource:
url : jdbc:mysql://xajhuang.com:3307/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
@ -39,77 +11,11 @@ spring :
#url : jdbc:mysql://localhost:3306/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
#username : root
#password : aaaHuang1
driver-class-name: com.mysql.cj.jdbc.Driver
dbcp2 :
max-total : 128
max-wait-millis : 10000
max-idle : 32
min-idle : 8
initial-size : 8
validation-query : SELECT 1
test-while-idle : true
connection-properties:
characterEncoding: utf8
sql :
init:
encoding : utf8
schema-locations: file:../config/rbac/schema.sql
data-locations : file:../config/rbac/data.sql
# ALWAYS/EMBEDDED/NEVER
mode : always
enabled : true
#mybatis
mybatis :
mapper-locations : classpath*:mappers/*.xml
type-aliases-package: com.cf.cs.database.pojo.entry
configuration :
default-enum-type-handler: com.cf.cs.database.common.DataBaseEnumHandler
mybatis-flex:
global-config:
print-banner: false
#pagehelper
pagehelper :
helper-dialect : mysql
reasonable : true
support-methods-arguments: true
pageSizeZero : true
params.count : countSql
#config log
logging :
config: file:../config/logback.xml
log4j :
logger:
org:
mybatis: info
# swagger-ui custom path
springdoc :
swagger-ui:
path: /swagger-ui.html
# JWT configure
jwt :
http-head : Authorization
secret-key : MTIzNDU2Nzg=
expire-time: 604800
# 字典配置
system :
dict:
raw-value : true
cache :
enabled: true
controller:
enabled: false
prefix : /dict
casbin:
model-path: ../config/casbin/model.conf
policy-path: ../config/casbin/policy.csv

View File

@ -1,3 +1,3 @@
spring:
profiles:
active: local, user
active: local, common, user

View File

@ -18,7 +18,7 @@ import org.springframework.test.context.ContextConfiguration;
* @author xajhuang @163.com
*/
@SpringBootTest(classes = {CsAuthenticationApplication.class})
@ActiveProfiles({"user", "test"})
@ActiveProfiles({"common", "user", "test"})
@ContextConfiguration(classes = {CacheConfigure.class, CommonConfigure.class, MybatisFlexConfigure.class,
UserSecurityConfigure.class, SecuritySecurity.class, ProtocolConfigure.class})
class CsAuthenticationApplicationTests {

View File

@ -3,6 +3,7 @@ package com.cf.cs.base;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
/**
* The type Cs base application tests.
@ -10,6 +11,7 @@ import org.springframework.boot.test.context.SpringBootTest;
* @author xajhuang @163.com
*/
@SpringBootTest
@ActiveProfiles({"common", "user", "test"})
class CsBaseApplicationTests {
/**

View File

@ -16,7 +16,7 @@ import org.springframework.test.context.ContextConfiguration;
* @author xajhuang @163.com
*/
@SpringBootTest(classes = {CsDatabaseApplication.class})
@ActiveProfiles({"user", "test"})
@ActiveProfiles({"common", "user", "test"})
@ContextConfiguration(classes = {CacheConfigure.class, CommonConfigure.class, ObjectMapperProvider.class,
MybatisFlexConfigure.class})
class CsDatabaseApplicationTests {

View File

@ -40,7 +40,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = {CsIntegrateTestApplication.class})
@AutoConfigureMockMvc
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ActiveProfiles({"user", "test"})
@ActiveProfiles({"common", "test", "user"})
public abstract class TestBaseAuthentication {
protected static final ThreadLocal<HttpHeaders> headersThreadLocal = new ThreadLocal<>();

View File

@ -17,7 +17,7 @@ import org.springframework.test.context.ContextConfiguration;
* @author xajhuang @163.com
*/
@SpringBootTest(classes = {CsProtocolApplication.class})
@ActiveProfiles({"user", "test"})
@ActiveProfiles({"common", "user", "test"})
@ContextConfiguration(classes = {CacheConfigure.class, CommonConfigure.class, ObjectMapperProvider.class, MybatisFlexConfigure.class,
ProtocolConfigure.class})
class CsProtocolApplicationTests {

View File

@ -11,7 +11,7 @@ import org.springframework.test.context.ActiveProfiles;
* @author xajhuang @163.com
*/
@SpringBootTest(classes = {CsRestfulApplication.class})
@ActiveProfiles({"user", "test"})
@ActiveProfiles({"common", "user", "test"})
class CsRestfulApplicationTests {
/**