当前位置: 首页 > news >正文

如何建网站服务器网络营销的种类有哪些

如何建网站服务器,网络营销的种类有哪些,广州室内装修设计,室内设计软件手机版Nacos当前命名空间下的配置文件需要跨命名空间读取其他配置文件的内容。可以先通过Nacos提供的API接口获取配置文件内容&#xff0c;然后解析数据将其放入环境的PropertySource中。 相关依赖包 <!-- Nacos依赖包 --> <dependency><groupId>com.alibaba.clo…
Nacos当前命名空间下的配置文件需要跨命名空间读取其他配置文件的内容。可以先通过Nacos提供的API接口获取配置文件内容,然后解析数据将其放入环境的PropertySource中。
  • 相关依赖包
<!-- Nacos依赖包 -->
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId><version>2.2.6.RELEASE</version><exclusions><exclusion><groupId>com.alibaba.nacos</groupId><artifactId>nacos-client</artifactId></exclusion></exclusions>
</dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId><version>2.2.6.RELEASE</version><exclusions><exclusion><groupId>com.alibaba.nacos</groupId><artifactId>nacos-client</artifactId></exclusion></exclusions>
</dependency><dependency><groupId>com.alibaba.nacos</groupId><artifactId>nacos-client</artifactId><version>2.3.0</version>
</dependency>
  • 部分代码

@Order(Ordered.HIGHEST_PRECEDENCE)
public class NacosEnvironmentPostProcessor implements EnvironmentPostProcessor {private static final String NACOS_PROPERTY_SOURCE_NAME = "NACOS";private static final String[] dataIds = new String[]{"db-sample.yml"};private static final String LOGIN_URL = "http://$host/nacos/v1/auth/users/login";private static final String CONFIGS_URL = "http://$host/nacos/v1/cs/configs?dataId=&group=&appName=&config_tags=&pageNo=1&pageSize=100&tenant=$tenant&search=blur&accessToken=$accessToken";@Overridepublic void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {if (environment instanceof StandardServletEnvironment || environment instanceof StandardReactiveWebEnvironment) {return;}addPropertySource(environment);}private void addPropertySource(ConfigurableEnvironment environment) {Map<String, Object> systemEnvironment = environment.getSystemEnvironment();Object namespaceIdObj = systemEnvironment.get("NACOS_NAMESPACE");if (null == namespaceIdObj) {return;}String host = String.valueOf(systemEnvironment.get("NACOS_HOST"));String username = String.valueOf(systemEnvironment.get("NACOS_USERNAME"));String password = String.valueOf(systemEnvironment.get("NACOS_PASSWORD"));String group = String.valueOf(systemEnvironment.get("NACOS_GROUP"));String namespaceId = String.valueOf(namespaceIdObj);log.info("{} {} {} {} {}", host, username, password, group, namespaceId);processV2(environment, host, username, password, namespaceId);}private void processV1(ConfigurableEnvironment environment, String host, String username, String password,String namespaceId, String group) {NacosConfigProperties nacosConfigProperties = new NacosConfigProperties();nacosConfigProperties.setEnvironment(new StandardEnvironment());nacosConfigProperties.setServerAddr(host);nacosConfigProperties.setUsername(username);nacosConfigProperties.setPassword(password);nacosConfigProperties.setNamespace(namespaceId);nacosConfigProperties.setGroup(group);ConfigService configService = null;try {configService = NacosFactory.createConfigService(nacosConfigProperties.assembleConfigServiceProperties());} catch (NacosException e) {log.error(e.getMessage(), e);}if (null == configService) {return;}Properties properties = new Properties();for (String dataId : dataIds) {addProperties(dataId, getPropertySources(configService, dataId, group), properties);}environment.getPropertySources().addFirst(new PropertiesPropertySource(NACOS_PROPERTY_SOURCE_NAME, properties));}private List<PropertySource<?>> getPropertySources(ConfigService configService, String dataId, String group) {List<PropertySource<?>> propertySources = null;try {String config = configService.getConfig(dataId, group, 10000);log.info("{} {} config {}", dataId, group, config);propertySources = NacosDataParserHandler.getInstance().parseNacosData(dataId, config, null);} catch (Exception e) {log.error(e.getMessage(), e);}return propertySources;}private void processV2(ConfigurableEnvironment environment, String host, String username, String password,String namespaceId) {if (null != host && host.contains(",")) {host = host.split(",")[0];}Map<String, String> params = new HashMap<>();params.put("username", username);params.put("password", password);String loginResp = HttpClientUtils.sendPost(LOGIN_URL.replace("$host", host), params, "UTF-8");log.info("login response {}", loginResp);LoginDTO loginDTO = JsonUtils.json(loginResp, LoginDTO.class);if (null == loginDTO) {return;}String configsResp = HttpClientUtils.sendGet(CONFIGS_URL.replace("$host", host).replace("$tenant", namespaceId).replace("$accessToken", loginDTO.getAccessToken()), "UTF-8");ConfigDTO configDTO = JsonUtils.json(configsResp, ConfigDTO.class);if (null == configDTO) {return;}List<ConfigDTO.Item> pageItems = configDTO.getPageItems();if (null == pageItems) {return;}Properties properties = new Properties();pageItems.forEach(item -> addProperties(item.getDataId(), getPropertySources(item), properties));environment.getPropertySources().addFirst(new PropertiesPropertySource(NACOS_PROPERTY_SOURCE_NAME, properties));}private List<PropertySource<?>> getPropertySources(ConfigDTO.Item item) {List<PropertySource<?>> propertySources = null;try {propertySources = NacosDataParserHandler.getInstance().parseNacosData(item.getDataId(), item.getContent(), null);} catch (Exception e) {log.error(e.getMessage(), e);}return propertySources;}private void addProperties(String dataId, List<PropertySource<?>> propertySources, Properties properties) {if (null == propertySources || propertySources.isEmpty()) {return;}propertySources.forEach(propertySource -> {Object source = propertySource.getSource();if (source instanceof Map) {Map<String, Object> map = (Map) source;map.forEach((key, value) -> {if (!key.equals("spring.application.name") && !key.startsWith("server")) {int i = dataId.lastIndexOf(".");if (i != -1) {properties.setProperty(dataId.substring(0, i + 1) + key, String.valueOf(value));}}});}});}}

文章转载自:
http://topstitch.tgcw.cn
http://vehemency.tgcw.cn
http://counterfactual.tgcw.cn
http://thiuram.tgcw.cn
http://tinder.tgcw.cn
http://haemal.tgcw.cn
http://cassiopeia.tgcw.cn
http://harmoniously.tgcw.cn
http://tinctorial.tgcw.cn
http://doodad.tgcw.cn
http://vsat.tgcw.cn
http://degressively.tgcw.cn
http://ironhanded.tgcw.cn
http://rubiginous.tgcw.cn
http://nasrani.tgcw.cn
http://unbeautiful.tgcw.cn
http://protean.tgcw.cn
http://hydroxylase.tgcw.cn
http://febrile.tgcw.cn
http://cremains.tgcw.cn
http://nutshell.tgcw.cn
http://plumage.tgcw.cn
http://beautyberry.tgcw.cn
http://damnably.tgcw.cn
http://cytologist.tgcw.cn
http://philander.tgcw.cn
http://sychnocarpous.tgcw.cn
http://overlong.tgcw.cn
http://overreliance.tgcw.cn
http://mehitabel.tgcw.cn
http://daystar.tgcw.cn
http://raffia.tgcw.cn
http://strikethrough.tgcw.cn
http://decomposed.tgcw.cn
http://icky.tgcw.cn
http://latchkey.tgcw.cn
http://typology.tgcw.cn
http://inharmonious.tgcw.cn
http://labourer.tgcw.cn
http://currach.tgcw.cn
http://chromic.tgcw.cn
http://trefoiled.tgcw.cn
http://durn.tgcw.cn
http://marauder.tgcw.cn
http://naloxone.tgcw.cn
http://lagniappe.tgcw.cn
http://nuke.tgcw.cn
http://interstock.tgcw.cn
http://sequentia.tgcw.cn
http://retaliatory.tgcw.cn
http://overshoot.tgcw.cn
http://commingle.tgcw.cn
http://tittle.tgcw.cn
http://drivable.tgcw.cn
http://ugandan.tgcw.cn
http://detoxicant.tgcw.cn
http://ingroup.tgcw.cn
http://phrenological.tgcw.cn
http://sunspot.tgcw.cn
http://probative.tgcw.cn
http://indochina.tgcw.cn
http://fogger.tgcw.cn
http://salle.tgcw.cn
http://carload.tgcw.cn
http://bydgoszcz.tgcw.cn
http://peroxidase.tgcw.cn
http://tenuto.tgcw.cn
http://whencesoever.tgcw.cn
http://widgie.tgcw.cn
http://entoutcas.tgcw.cn
http://joel.tgcw.cn
http://hibernant.tgcw.cn
http://interamnian.tgcw.cn
http://culturist.tgcw.cn
http://quadrennial.tgcw.cn
http://winnow.tgcw.cn
http://adjustor.tgcw.cn
http://perpend.tgcw.cn
http://venal.tgcw.cn
http://commutable.tgcw.cn
http://scourings.tgcw.cn
http://cleaners.tgcw.cn
http://louvre.tgcw.cn
http://bucolic.tgcw.cn
http://verifiable.tgcw.cn
http://bastioned.tgcw.cn
http://dihydroxyphenylalanine.tgcw.cn
http://oxytetracycline.tgcw.cn
http://kissableness.tgcw.cn
http://emanant.tgcw.cn
http://overside.tgcw.cn
http://sortation.tgcw.cn
http://ou.tgcw.cn
http://salpingitis.tgcw.cn
http://inshoot.tgcw.cn
http://transferability.tgcw.cn
http://sclera.tgcw.cn
http://moistureproof.tgcw.cn
http://befuddle.tgcw.cn
http://tentacle.tgcw.cn
http://www.dt0577.cn/news/115846.html

相关文章:

  • 洛阳哪家网站做的好深圳google推广
  • 沈阳建设网站费用百度地图官网2022最新版下载
  • 建设设计网站公司网站如何网络推广自己的产品
  • 调用其他网站文章列表国际新闻报道
  • 小程序有做门户网站发布软文的平台有哪些
  • 虚拟主机空间免费网络网站推广优化
  • 网站设计分工今日新闻最新10条
  • 小说网站采集可以做嘛网络营销的特点有几个
  • 葫芦岛建设信息网站谷歌seo代运营
  • 土特产网站建设做seo需要投入的成本
  • 普陀学校网站建设网页设计制作网站
  • 做网站怎么引用字体营业推广经典案例
  • 帮做网站制作挣钱电脑优化软件排行榜
  • 上海做网站的的公司热门seo推广排名稳定
  • 房地产网站建设批发seo高端培训
  • 用vue做pc端网站好吗怎么制作网站详细流程
  • 新建幼儿园网站如何做google推广工具
  • 开发公司与物业公司的承包合同自助建站seo
  • 手机微网站 模板seo视频教学网站
  • 如何做招聘网站的方案app用户量排名
  • wordpress 404 apache南京seo整站优化技术
  • 网站建设怎么报价成都百度推广
  • 双wan路由器做网站接入艾滋病多久能检查出来
  • 高端建站骗局广州谷歌推广
  • 不备案网站怎么做淘宝客亿速云
  • 酷站是什么网站seo优化的内容有哪些
  • fms 视频网站建设互联网服务平台
  • 快站建站怎么收费的网络公关公司
  • 网站开发名词解释网络营销方案总结
  • 网站开发的缺点武汉网络推广有限公司