新增:数据源预热,三方模块配置区分环境
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
//package com.sdm.common.config;//package com.sdm.project.config.mybatis;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Qualifier;
|
||||
//import org.springframework.boot.ApplicationRunner;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//import java.sql.Connection;
|
||||
//
|
||||
//@Slf4j
|
||||
//@Configuration
|
||||
//public class DataSourcePreWarmer {
|
||||
//
|
||||
// @Bean
|
||||
// public ApplicationRunner secondDataSourcePreWarmer(
|
||||
// @Qualifier("secondDataSource") DataSource secondDataSource) {
|
||||
// return args -> {
|
||||
// try (Connection conn = secondDataSource.getConnection()) {
|
||||
// log.info("✅ secondDataSource 预热成功,连接已建立: {}", conn);
|
||||
// } catch (Exception e) {
|
||||
// log.error("❌ secondDataSource 预热失败", e);
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public ApplicationRunner mainDataSourcePreWarmer(
|
||||
// @Qualifier("masterDataSource") DataSource master,
|
||||
// @Qualifier("slaveDataSource") DataSource slave) {
|
||||
// return args -> {
|
||||
// try {
|
||||
// try (Connection c1 = master.getConnection()) {
|
||||
// log.info("✅ masterDataSource 预热成功: {}", c1);
|
||||
// }
|
||||
// try (Connection c2 = slave.getConnection()) {
|
||||
// log.info("✅ slaveDataSource 预热成功: {}", c2);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("❌ 主从数据源预热失败", e);
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
//}
|
||||
@@ -208,13 +208,13 @@ public class AESUtil {
|
||||
try {
|
||||
// 优先读取JVM参数,然后环境变量参数,没有就报错
|
||||
// String spdmEnkey = "H7qGt/DO3VdaAVKzY3PNvQ==";
|
||||
// String spdmEnkey = "XzKRqYnUypdE8VJ41yo/i0rMpZ0IlztSZ1PqWhr0q/c=";
|
||||
String spdmEnkey = StringUtils.isBlank(System.getProperty("spdm.enkey"))?
|
||||
System.getenv("spdm.enkey"):System.getProperty("spdm.enkey");
|
||||
if(StringUtils.isBlank(spdmEnkey)){
|
||||
throw new RuntimeException("spdm加密配置密钥读取失败!");
|
||||
}
|
||||
System.out.println("密钥是:"+spdmEnkey);
|
||||
String ret = encodeNew("EP_DM@123.COM",spdmEnkey);
|
||||
String ret = encodeNew("mysql",spdmEnkey);
|
||||
System.out.println("encode:" + ret);
|
||||
String raw = decodeNew(ret,spdmEnkey);
|
||||
System.out.println("decode:" + raw);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.sdm.outbridge.config; //// common模块:com.xxx.common.config.CommonConfig
|
||||
package com.sdm.outbridge.config;
|
||||
|
||||
import com.sdm.common.utils.AESUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -20,7 +20,10 @@ import java.util.Map;
|
||||
* encoding:解决中文乱码
|
||||
*/
|
||||
@Configuration
|
||||
@PropertySource(value = "classpath:common.yml", factory = CommonConfig.YamlPropertySourceFactory.class)
|
||||
@PropertySource(
|
||||
value = "classpath:common-${spring.profiles.active:lyric}.yml",
|
||||
factory = CommonConfig.YamlPropertySourceFactory.class
|
||||
)
|
||||
public class CommonConfig {
|
||||
// 自定义YamlPropertySourceFactory,解决@PropertySource不支持yml的问题
|
||||
public static class YamlPropertySourceFactory extends DefaultPropertySourceFactory {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.sdm.outbridge.config;//package com.sdm.project.config.mybatis;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
|
||||
//
|
||||
@Slf4j
|
||||
@ConditionalOnProperty(name = "spring.profiles.active", havingValue = "lyric")
|
||||
@Configuration
|
||||
public class DataSourcePreWarmer {
|
||||
|
||||
@Bean
|
||||
public ApplicationRunner secondDataSourcePreWarmer(
|
||||
@Qualifier("secondDataSource") DataSource secondDataSource) {
|
||||
return args -> {
|
||||
try (Connection conn = secondDataSource.getConnection()) {
|
||||
log.info("✅ secondDataSource 预热成功,连接已建立: {}", conn);
|
||||
} catch (Exception e) {
|
||||
log.error("❌ secondDataSource 预热失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// @Bean
|
||||
// public ApplicationRunner mainDataSourcePreWarmer(
|
||||
// @Qualifier("masterDataSource") DataSource master,
|
||||
// @Qualifier("slaveDataSource") DataSource slave) {
|
||||
// return args -> {
|
||||
// try {
|
||||
// try (Connection c1 = master.getConnection()) {
|
||||
// log.info("✅ masterDataSource 预热成功: {}", c1);
|
||||
// }
|
||||
// try (Connection c2 = slave.getConnection()) {
|
||||
// log.info("✅ slaveDataSource 预热成功: {}", c2);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("❌ 主从数据源预热失败", e);
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
|
||||
}
|
||||
42
outbridge/src/main/resources/common-dev-190.yml
Normal file
42
outbridge/src/main/resources/common-dev-190.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
spring:
|
||||
datasource:
|
||||
second:
|
||||
username: root
|
||||
password: mysql
|
||||
# todo 生产地址
|
||||
jdbc-url: jdbc:mysql://127.0.0.1:13306/easy_project?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
# 测试开发环境
|
||||
#appKey : 380ad3deb578424c9ca5178383f732c1
|
||||
#appSecret : 805c316f35024b8b9566ca67b4991c42
|
||||
#appKey : d39820947556421aa329b070e669dfa2
|
||||
#corpKey : e906d13947944947921bb32c8fcffc6e
|
||||
#appSecret : 13cff5f8fb1c479297370a7d41853158
|
||||
appKey : 123
|
||||
appSecret : 123
|
||||
# 海葵云url
|
||||
HK_CLOUD_URL : https://v15.lyh.haikuicloud.com
|
||||
# 1. 海葵云获取用户token url后缀
|
||||
HK_USER_TOKEN_URL_SUFFIX: /merchant/openapi/user/login/jobNo
|
||||
# 2. 海葵云获取单个用户信息url后缀
|
||||
HK_SIMPLE_USER_URL_SUFFIX: /merchant/api/user/getSimpleUserInfo
|
||||
# 3. 海葵云上传文件url后缀
|
||||
HK_UPLOAD_FILE_URL_SUFFIX: /haikui-oa/autoCreateFlow/uploadFile
|
||||
# 获取项目工位实例号
|
||||
HK_GET_PROCESS_DATA_SUFFIX: /haikui-oa/autoCreateFlow/getProcessData/oa_three_d_review
|
||||
|
||||
# EP系统URL
|
||||
#EP_URL : https://ep-url.dev.haikuicloud.com
|
||||
# 开发环境
|
||||
EP_URL: https://ep-url-test.lyh.haikuicloud.com
|
||||
# 推送代办状态url后缀
|
||||
QUERY_TODO_STATUS_SUFFIX: /todoApi/todo/emulation/dm/status
|
||||
# 查询待办结果url后缀
|
||||
QUERY_TODO_RESULT_SUFFIX: /todoApi/todo/emulation/dm/result
|
||||
# 6. 查询待办附加url后缀
|
||||
QUERY_TOD_ATTACHMENT_SUFFIX: /todoApi/todo/emulation/dm/attachments
|
||||
|
||||
# 即时通url
|
||||
FREELINK_URL: http://freelink.haikui.com
|
||||
FREELINK_PUSH_MSG_SUFFIX: /webchat/InformApi/FreelinkAndDingdingInform
|
||||
42
outbridge/src/main/resources/common-dev-65.yml
Normal file
42
outbridge/src/main/resources/common-dev-65.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
spring:
|
||||
datasource:
|
||||
second:
|
||||
username: root
|
||||
password: mysql
|
||||
# todo 生产地址
|
||||
jdbc-url: jdbc:mysql://127.0.0.1:13306/easy_project?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
# 测试开发环境
|
||||
#appKey : 380ad3deb578424c9ca5178383f732c1
|
||||
#appSecret : 805c316f35024b8b9566ca67b4991c42
|
||||
#appKey : d39820947556421aa329b070e669dfa2
|
||||
#corpKey : e906d13947944947921bb32c8fcffc6e
|
||||
#appSecret : 13cff5f8fb1c479297370a7d41853158
|
||||
appKey : 123
|
||||
appSecret : 123
|
||||
# 海葵云url
|
||||
HK_CLOUD_URL : https://v15.lyh.haikuicloud.com
|
||||
# 1. 海葵云获取用户token url后缀
|
||||
HK_USER_TOKEN_URL_SUFFIX: /merchant/openapi/user/login/jobNo
|
||||
# 2. 海葵云获取单个用户信息url后缀
|
||||
HK_SIMPLE_USER_URL_SUFFIX: /merchant/api/user/getSimpleUserInfo
|
||||
# 3. 海葵云上传文件url后缀
|
||||
HK_UPLOAD_FILE_URL_SUFFIX: /haikui-oa/autoCreateFlow/uploadFile
|
||||
# 获取项目工位实例号
|
||||
HK_GET_PROCESS_DATA_SUFFIX: /haikui-oa/autoCreateFlow/getProcessData/oa_three_d_review
|
||||
|
||||
# EP系统URL
|
||||
#EP_URL : https://ep-url.dev.haikuicloud.com
|
||||
# 开发环境
|
||||
EP_URL: https://ep-url-test.lyh.haikuicloud.com
|
||||
# 推送代办状态url后缀
|
||||
QUERY_TODO_STATUS_SUFFIX: /todoApi/todo/emulation/dm/status
|
||||
# 查询待办结果url后缀
|
||||
QUERY_TODO_RESULT_SUFFIX: /todoApi/todo/emulation/dm/result
|
||||
# 6. 查询待办附加url后缀
|
||||
QUERY_TOD_ATTACHMENT_SUFFIX: /todoApi/todo/emulation/dm/attachments
|
||||
|
||||
# 即时通url
|
||||
FREELINK_URL: http://freelink.haikui.com
|
||||
FREELINK_PUSH_MSG_SUFFIX: /webchat/InformApi/FreelinkAndDingdingInform
|
||||
42
outbridge/src/main/resources/common-local.yml
Normal file
42
outbridge/src/main/resources/common-local.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
spring:
|
||||
datasource:
|
||||
second:
|
||||
username: root
|
||||
password: mysql
|
||||
# todo 生产地址
|
||||
jdbc-url: jdbc:mysql://127.0.0.1:13306/easy_project?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
# 测试开发环境
|
||||
#appKey : 380ad3deb578424c9ca5178383f732c1
|
||||
#appSecret : 805c316f35024b8b9566ca67b4991c42
|
||||
#appKey : d39820947556421aa329b070e669dfa2
|
||||
#corpKey : e906d13947944947921bb32c8fcffc6e
|
||||
#appSecret : 13cff5f8fb1c479297370a7d41853158
|
||||
appKey : 123
|
||||
appSecret : 123
|
||||
# 海葵云url
|
||||
HK_CLOUD_URL : https://v15.lyh.haikuicloud.com
|
||||
# 1. 海葵云获取用户token url后缀
|
||||
HK_USER_TOKEN_URL_SUFFIX: /merchant/openapi/user/login/jobNo
|
||||
# 2. 海葵云获取单个用户信息url后缀
|
||||
HK_SIMPLE_USER_URL_SUFFIX: /merchant/api/user/getSimpleUserInfo
|
||||
# 3. 海葵云上传文件url后缀
|
||||
HK_UPLOAD_FILE_URL_SUFFIX: /haikui-oa/autoCreateFlow/uploadFile
|
||||
# 获取项目工位实例号
|
||||
HK_GET_PROCESS_DATA_SUFFIX: /haikui-oa/autoCreateFlow/getProcessData/oa_three_d_review
|
||||
|
||||
# EP系统URL
|
||||
#EP_URL : https://ep-url.dev.haikuicloud.com
|
||||
# 开发环境
|
||||
EP_URL: https://ep-url-test.lyh.haikuicloud.com
|
||||
# 推送代办状态url后缀
|
||||
QUERY_TODO_STATUS_SUFFIX: /todoApi/todo/emulation/dm/status
|
||||
# 查询待办结果url后缀
|
||||
QUERY_TODO_RESULT_SUFFIX: /todoApi/todo/emulation/dm/result
|
||||
# 6. 查询待办附加url后缀
|
||||
QUERY_TOD_ATTACHMENT_SUFFIX: /todoApi/todo/emulation/dm/attachments
|
||||
|
||||
# 即时通url
|
||||
FREELINK_URL: http://freelink.haikui.com
|
||||
FREELINK_PUSH_MSG_SUFFIX: /webchat/InformApi/FreelinkAndDingdingInform
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
datasource:
|
||||
second:
|
||||
username: EP_DM
|
||||
password: EP_DM@123.COM
|
||||
password: ENC(c04rt9Z6Ygz024EU9eWvig==)
|
||||
# todo 生产地址
|
||||
jdbc-url: jdbc:mysql://10.122.48.11:13306/easy_project?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
42
outbridge/src/main/resources/common-test.yml
Normal file
42
outbridge/src/main/resources/common-test.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
spring:
|
||||
datasource:
|
||||
second:
|
||||
username: root
|
||||
password: mysql
|
||||
# todo 生产地址
|
||||
jdbc-url: jdbc:mysql://127.0.0.1:13306/easy_project?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
# 测试开发环境
|
||||
#appKey : 380ad3deb578424c9ca5178383f732c1
|
||||
#appSecret : 805c316f35024b8b9566ca67b4991c42
|
||||
#appKey : d39820947556421aa329b070e669dfa2
|
||||
#corpKey : e906d13947944947921bb32c8fcffc6e
|
||||
#appSecret : 13cff5f8fb1c479297370a7d41853158
|
||||
appKey : 123
|
||||
appSecret : 123
|
||||
# 海葵云url
|
||||
HK_CLOUD_URL : https://v15.lyh.haikuicloud.com
|
||||
# 1. 海葵云获取用户token url后缀
|
||||
HK_USER_TOKEN_URL_SUFFIX: /merchant/openapi/user/login/jobNo
|
||||
# 2. 海葵云获取单个用户信息url后缀
|
||||
HK_SIMPLE_USER_URL_SUFFIX: /merchant/api/user/getSimpleUserInfo
|
||||
# 3. 海葵云上传文件url后缀
|
||||
HK_UPLOAD_FILE_URL_SUFFIX: /haikui-oa/autoCreateFlow/uploadFile
|
||||
# 获取项目工位实例号
|
||||
HK_GET_PROCESS_DATA_SUFFIX: /haikui-oa/autoCreateFlow/getProcessData/oa_three_d_review
|
||||
|
||||
# EP系统URL
|
||||
#EP_URL : https://ep-url.dev.haikuicloud.com
|
||||
# 开发环境
|
||||
EP_URL: https://ep-url-test.lyh.haikuicloud.com
|
||||
# 推送代办状态url后缀
|
||||
QUERY_TODO_STATUS_SUFFIX: /todoApi/todo/emulation/dm/status
|
||||
# 查询待办结果url后缀
|
||||
QUERY_TODO_RESULT_SUFFIX: /todoApi/todo/emulation/dm/result
|
||||
# 6. 查询待办附加url后缀
|
||||
QUERY_TOD_ATTACHMENT_SUFFIX: /todoApi/todo/emulation/dm/attachments
|
||||
|
||||
# 即时通url
|
||||
FREELINK_URL: http://freelink.haikui.com
|
||||
FREELINK_PUSH_MSG_SUFFIX: /webchat/InformApi/FreelinkAndDingdingInform
|
||||
Reference in New Issue
Block a user