@Bean
    @ConditionalOnMissingBean(ConfigService.class)
    public ConfigService nacosConfigService(final NacosProperties nacosProp) throws Exception {
        Properties properties = new Properties();
        if (Objects.nonNull(nacosProp.getAcm()) && nacosProp.getAcm().isEnabled()) {
            // Use aliyun ACM service
            properties.put(PropertyKeyConst.ENDPOINT, nacosProp.getAcm().getEndpoint());
            properties.put(PropertyKeyConst.NAMESPACE, nacosProp.getAcm().getNamespace());
            // Use subaccount ACM administrative authority
            properties.put(PropertyKeyConst.ACCESS_KEY, nacosProp.getAcm().getAccessKey());
            properties.put(PropertyKeyConst.SECRET_KEY, nacosProp.getAcm().getSecretKey());
        } else {
            properties.put(PropertyKeyConst.SERVER_ADDR, nacosProp.getUrl());
            if (StringUtils.isNotBlank(nacosProp.getNamespace())) {
                properties.put(PropertyKeyConst.NAMESPACE, nacosProp.getNamespace());
            }
            if (StringUtils.isNotBlank(nacosProp.getUsername())) {
                properties.put(PropertyKeyConst.USERNAME, nacosProp.getUsername());
            }
            if (StringUtils.isNotBlank(nacosProp.getPassword())) {
                properties.put(PropertyKeyConst.PASSWORD, nacosProp.getPassword());
            }
        }
        return NacosFactory.createConfigService(properties);
    }
@Test
    public void nacosConfigServiceTest() {
        try (MockedStatic<NacosFactory> nacosFactoryMockedStatic = mockStatic(NacosFactory.class)) {
            final NacosProperties nacosProperties = new NacosProperties();
            final NacosProperties.NacosACMProperties nacosACMProperties = new NacosProperties.NacosACMProperties();
            nacosProperties.setAcm(nacosACMProperties);
            nacosFactoryMockedStatic.when(() -> NacosFactory.createConfigService(any(Properties.class))).thenReturn(mock(ConfigService.class));
            NacosSyncConfiguration nacosListener = new NacosSyncConfiguration();
            nacosProperties.setUrl("url");
            Assertions.assertDoesNotThrow(() -> nacosListener.nacosConfigService(nacosProperties));
            nacosProperties.setNamespace("url");
            nacosProperties.setUsername("username");
            nacosProperties.setPassword("password");
            Assertions.assertDoesNotThrow(() -> nacosListener.nacosConfigService(nacosProperties));
            nacosACMProperties.setEnabled(true);
            nacosACMProperties.setEndpoint("acm.aliyun.com");
            nacosACMProperties.setAccessKey("accessKey");
            nacosACMProperties.setNamespace("namespace");
            nacosACMProperties.setSecretKey("secretKey");
            Assertions.assertDoesNotThrow(() -> nacosListener.nacosConfigService(nacosProperties));
        }
    }