xieb
2023-08-01 3fde6b45ddfcccb76bcb86c8b0e415342c443ce1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package cn.gistack.nky.launch;
 
import cn.gistack.common.constant.LauncherConstant;
import org.springblade.core.auto.service.AutoService;
import org.springblade.core.launch.service.LauncherService;
import org.springblade.core.launch.utils.PropsUtil;
import org.springframework.boot.builder.SpringApplicationBuilder;
 
import java.util.Properties;
 
/**
 * @PROJECT_NAME: skjcmanager
 * @DESCRIPTION: nacos配置
 * @USER: aix
 * @DATE: 2023/7/31 10:51
 */
@AutoService(LauncherService.class)
public class NkyLauncherServiceImpl implements LauncherService {
 
    @Override
    public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {
        Properties props = System.getProperties();
        // 通用注册
        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");
    }
}