public class LauncherServiceImpl implements LauncherService {
@Override
public void launcher(SpringApplicationBuilder builder, String appName, String profile) {
Properties props = System.getProperties();
props.setProperty("spring.cloud.nacos.discovery.server-addr", LauncherConstant.nacosAddr(profile));
props.setProperty("spring.cloud.nacos.config.server-addr", LauncherConstant.nacosAddr(profile));
//props.setProperty("spring.cloud.nacos.discovery.server-addr", "10.223.0.80:8848");
//props.setProperty("spring.cloud.nacos.config.server-addr", "10.223.0.80:8848");
props.setProperty("spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile));
//props.setProperty("spring.cloud.sentinel.transport.dashboard", "10.223.0.199:8858");
props.setProperty("spring.zipkin.base-url", LauncherConstant.zipkinAddr(profile));
}
}
这里改为我私有网络的地址,是可以使用的,但是这样写到代码里面感觉很不爽啊,能否使用配置文件的形式呢?
扫一扫访问 Blade技术社区 移动端