|
@@ -27,7 +27,6 @@ package org.springblade.common.launch;
|
|
|
|
|
|
import org.springblade.common.constant.LauncherConstant;
|
|
import org.springblade.common.constant.LauncherConstant;
|
|
import org.springblade.core.auto.service.AutoService;
|
|
import org.springblade.core.auto.service.AutoService;
|
|
-import org.springblade.core.launch.constant.NacosConstant;
|
|
|
|
import org.springblade.core.launch.service.LauncherService;
|
|
import org.springblade.core.launch.service.LauncherService;
|
|
import org.springblade.core.launch.utils.PropsUtil;
|
|
import org.springblade.core.launch.utils.PropsUtil;
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
@@ -45,19 +44,22 @@ public class LauncherServiceImpl implements LauncherService {
|
|
@Override
|
|
@Override
|
|
public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {
|
|
public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {
|
|
Properties props = System.getProperties();
|
|
Properties props = System.getProperties();
|
|
|
|
+ // 指定注册配置信息
|
|
|
|
+ PropsUtil.setProperty(props, "spring.cloud.nacos.username", LauncherConstant.NACOS_USERNAME);
|
|
|
|
+ PropsUtil.setProperty(props, "spring.cloud.nacos.password", LauncherConstant.NACOS_PASSWORD);
|
|
|
|
+ PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.server-addr", LauncherConstant.nacosAddr(profile));
|
|
|
|
+ PropsUtil.setProperty(props, "spring.cloud.nacos.config.server-addr", LauncherConstant.nacosAddr(profile));
|
|
|
|
+ PropsUtil.setProperty(props, "spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile));
|
|
|
|
+ PropsUtil.setProperty(props, "spring.zipkin.base-url", LauncherConstant.zipkinAddr(profile));
|
|
// 开启多数据源
|
|
// 开启多数据源
|
|
PropsUtil.setProperty(props, "spring.datasource.dynamic.enabled", "true");
|
|
PropsUtil.setProperty(props, "spring.datasource.dynamic.enabled", "true");
|
|
- // 指定注册配置信息
|
|
|
|
- PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].data-id", NacosConstant.dataId("example", profile));
|
|
|
|
- PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].group", NacosConstant.NACOS_CONFIG_GROUP);
|
|
|
|
- PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].refresh", NacosConstant.NACOS_CONFIG_REFRESH);
|
|
|
|
// 指定注册IP
|
|
// 指定注册IP
|
|
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.ip", "127.0.0.1");
|
|
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.ip", "127.0.0.1");
|
|
// 指定注册端口
|
|
// 指定注册端口
|
|
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.port", "8200");
|
|
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.port", "8200");
|
|
// 自定义命名空间
|
|
// 自定义命名空间
|
|
- // PropsUtil.setProperty(props, "spring.cloud.nacos.config.namespace", LauncherConstant.NACOS_NAMESPACE);
|
|
|
|
- // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.namespace", LauncherConstant.NACOS_NAMESPACE);
|
|
|
|
|
|
+ PropsUtil.setProperty(props, "spring.cloud.nacos.config.namespace", LauncherConstant.NACOS_NAMESPACE);
|
|
|
|
+ PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.namespace", LauncherConstant.NACOS_NAMESPACE);
|
|
// 自定义分组
|
|
// 自定义分组
|
|
// PropsUtil.setProperty(props, "spring.cloud.nacos.config.group", NacosConstant.NACOS_CONFIG_GROUP);
|
|
// PropsUtil.setProperty(props, "spring.cloud.nacos.config.group", NacosConstant.NACOS_CONFIG_GROUP);
|
|
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.group", NacosConstant.NACOS_CONFIG_GROUP);
|
|
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.group", NacosConstant.NACOS_CONFIG_GROUP);
|