liming0 commented on issue #25445:
URL:
https://github.com/apache/shardingsphere/issues/25445#issuecomment-1550958931
> It seems that there have no `ShardingSphereDriverURLProvider.class` and
`NacosDriverURLProvider.class` under 5.2.0.(the crash 5.3.x but who cares) so
welcome to use override.. welcome
>
> ```
> @Slf4j
> @SuppressWarnings({"PMD.ClassNamingShouldBeCamelRule"})
> public final class ShardingSphereDriverURL {
>
> /**
> * naocs default group
> */
> private static final String DEFAULT_GROUP = "DEFAULT_GROUP";
>
> public ShardingSphereDriverURL(String url) {
> log.info("==== [ShardingSphereDriverURL.initing]: {}");
> }
>
> public byte[] toConfigurationBytes() {
> String config = getShardingConfig();
> Preconditions.checkArgument(config != null, "Nacos config [
archetype-sharding ] is Empty.");
> return config.getBytes(StandardCharsets.UTF_8);
> }
>
> public String getShardingConfig(){
> NacosConfig nacosConfig =
SpringBeanContext.getContext().getBean(NacosConfig.class);
> Properties properties = new Properties();
> properties.put("serverAddr" , nacosConfig.getServerAddr());
> properties.put("username" , nacosConfig.getUserName());
> properties.put("password" , nacosConfig.getPassword());
> properties.put("namespace" , nacosConfig.getNamespace());
> // for print log
> properties.put("nacosImport", nacosConfig.getShardingConf());
> try {
> log.info("==== [ShardingConfig.loading]: {} ",
JSON.toJSONString(properties, SerializerFeature.PrettyFormat));
> ConfigService configService =
NacosFactory.createConfigService(properties);
> String content =
configService.getConfig(nacosConfig.getShardingConf(), DEFAULT_GROUP, 5000);
> log.info("==== [ShardingSphereDriverURL.inited]: {}");
> return content;
> }catch (NacosException e) {
> log.error("==== [ShardingSphereDriverURL.failed]: {}", e);
> }
> return null;
> }
>
>
> }
> ```
Yes, it only came in 5.3.2,My modification is based on 5.3.2. The
modification has been completed, but I encountered an unknown problem when
merging, which has not been solved for the time being
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]