Java Code Examples for org.springframework.util.StringUtils.tokenizeToStringArray()

The following are Jave code examples for showing how to use tokenizeToStringArray() of the org.springframework.util.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: configx   File: VersionRefreshBeanDefinitionDecorator.java   View Source Code Vote up 7 votes
@Override
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {

    // 设置bean scope为version-refresh
    definition.getBeanDefinition().setScope(VersionRefreshScope.SCOPE_NAME);

    String[] dependsOn = null;
    if (node instanceof Element) {
        Element ele = (Element) node;
        if (ele.hasAttribute(DEPENDS_ON)) {
            dependsOn = StringUtils.tokenizeToStringArray(ele.getAttribute(DEPENDS_ON), ",");
        }
    }

    // 注册属性依赖
    DependencyConfigUtils.registerDependency(parserContext.getRegistry(), definition.getBeanName(), dependsOn);

    return definition;
}
 
Example 2
Project: configx   File: ConfigMessageSourceBeanDefinitionParser.java   View Source Code Vote up 6 votes
protected void doParse(Element element, BeanDefinitionBuilder bean) {
    boolean fallbackToSystemLocale = false;
    String[] basenames = null;

    if (element.hasAttribute(FALLBACK_TO_SYSTEM_LOCALE)) {
        fallbackToSystemLocale = Boolean.valueOf(element.getAttribute(FALLBACK_TO_SYSTEM_LOCALE));
    }
    if (element.hasAttribute(BASENAMES)) {
        basenames = StringUtils.tokenizeToStringArray(element.getAttribute(BASENAMES), ",");
    }

    bean.addPropertyValue("fallbackToSystemLocale", fallbackToSystemLocale);
    bean.addPropertyValue("basenames", basenames);
}
 
Example 3
Project: gemini.blueprint   File: ConfigUtils.java   View Source Code Vote up 6 votes
/**
 * Similar to {@link #getHeaderLocations(Dictionary)} but looks at a
 * specified header directly.
 * 
 * @param header header to look at
 * @param defaultValue default locations if none is specified
 * @return
 */
public static String[] getLocationsFromHeader(String header, String defaultValue) {

	String[] ctxEntries;
	if (StringUtils.hasText(header) && !(';' == header.charAt(0))) {
		// get the config locations
		String locations = StringUtils.tokenizeToStringArray(header, DIRECTIVE_SEPARATOR)[0];
		// parse it into individual token
		ctxEntries = StringUtils.tokenizeToStringArray(locations, CONTEXT_LOCATION_SEPARATOR);

		// replace * with a 'digestable' location
		for (int i = 0; i < ctxEntries.length; i++) {
			if (CONFIG_WILDCARD.equals(ctxEntries[i]))
				ctxEntries[i] = defaultValue;
		}
	}
	else {
		ctxEntries = new String[0];
	}

	return ctxEntries;
}
 
Example 4
Project: lams   File: CronSequenceGenerator.java   View Source Code Vote up 6 votes
/**
 * Parse the given pattern expression.
 */
private void parse(String expression) throws IllegalArgumentException {
	String[] fields = StringUtils.tokenizeToStringArray(expression, " ");
	if (fields.length != 6) {
		throw new IllegalArgumentException(String.format(
				"Cron expression must consist of 6 fields (found %d in \"%s\")", fields.length, expression));
	}
	setNumberHits(this.seconds, fields[0], 0, 60);
	setNumberHits(this.minutes, fields[1], 0, 60);
	setNumberHits(this.hours, fields[2], 0, 24);
	setDaysOfMonth(this.daysOfMonth, fields[3]);
	setMonths(this.months, fields[4]);
	setDays(this.daysOfWeek, replaceOrdinals(fields[5], "SUN,MON,TUE,WED,THU,FRI,SAT"), 8);
	if (this.daysOfWeek.get(7)) {
		// Sunday can be represented as 0 or 7
		this.daysOfWeek.set(0);
		this.daysOfWeek.clear(7);
	}
}
 
Example 5
Project: configx   File: PropertiesFileConfigItemPostProcessor.java   View Source Code Vote up 5 votes
@Override
public void postProcessConfigItems(long version, ConfigPropertySource propertySource) {
    if (propertySource == null) { // 当前版本无属性
        return;
    }

    // 初始化propertySourceName
    if (propertySourceName == null) {
        if (environment.containsProperty(SPRING_PROPERTY_SOURCES)) {
            propertySourceName = environment.getProperty(SPRING_PROPERTY_SOURCES);
        } else {
            propertySourceName = DEFAULT_PROPERTY_SOURCES;
        }
    }

    // 从配置中心动态更新propertySourceName
    if (propertySource.containsProperty(SPRING_PROPERTY_SOURCES)) {
        propertySourceName = (String) propertySource.getProperty(SPRING_PROPERTY_SOURCES);
    }

    String[] propertySourceNames = StringUtils.tokenizeToStringArray(propertySourceName, DELIMITERS);
    if (propertySourceNames != null) {
        for (String name : propertySourceNames) {
            if (StringUtils.isEmpty(name)) {
                continue;
            }
            name = name.trim();
            if (propertySource.containsProperty(name)) {
                processPropertySource(propertySource, name);
            }
        }
    }
}
 
Example 6
Project: server   File: ConfigHelper.java   View Source Code Vote up 5 votes
/**
 * Converts content of last existing file in files to string array
 * 
 * @throws IOException
 */
public static String[] getStringsFromLastExists(String delimiter, File... files) throws IOException {
	String[] ret = new String[0];
	for (File f : files) {
		if (!f.exists())
			continue;

		String str = new String(FileCopyUtils.copyToByteArray(f), "UTF-8");
		ret = StringUtils.tokenizeToStringArray(str, delimiter);
	}
	return ret;
}
 
Example 7
Project: gemini.blueprint   File: ConfigUtils.java   View Source Code Vote up 5 votes
/**
 * Return the directive value as a String. If the directive does not exist
 * or is invalid (wrong format) a null string will be returned.
 * 
 * @param header
 * @param directive
 * @return
 */
public static String getDirectiveValue(String header, String directive) {
	Assert.notNull(header, "not-null header required");
	Assert.notNull(directive, "not-null directive required");
	String[] directives = StringUtils.tokenizeToStringArray(header, DIRECTIVE_SEPARATOR);

	for (int i = 0; i < directives.length; i++) {
		String[] splittedDirective = StringUtils.delimitedListToStringArray(directives[i].trim(), EQUALS);
		if (splittedDirective.length == 2 && splittedDirective[0].equals(directive))
			return splittedDirective[1];
	}

	return null;
}
 
Example 8
Project: parabuild-ci   File: DwrNamespaceHandler.java   View Source Code Vote up 5 votes
public BeanDefinition parse(Element element, ParserContext parserContext)
{
    BeanDefinitionBuilder dwrController = BeanDefinitionBuilder.rootBeanDefinition(DwrController.class);
    List configurators = new ManagedList();
    configurators.add(new RuntimeBeanReference(DEFAULT_SPRING_CONFIGURATOR_ID));
    dwrController.addPropertyValue("configurators", configurators);

    String debug = element.getAttribute("debug");
    if (StringUtils.hasText(debug))
    {
        dwrController.addPropertyValue("debug", debug);
    }

    String beanName = element.getAttribute(BeanDefinitionParserDelegate.ID_ATTRIBUTE);
    String nameAttr = element.getAttribute(BeanDefinitionParserDelegate.NAME_ATTRIBUTE);
    String[] aliases = null;
    if (!StringUtils.hasText(beanName))
    {
        beanName = element.getAttribute("name");
    }
    else
    {
        String aliasName = element.getAttribute("name");
        if (StringUtils.hasText(aliasName))
        {
            aliases = StringUtils.tokenizeToStringArray(nameAttr, BeanDefinitionParserDelegate.BEAN_NAME_DELIMITERS);
        }
    }

    parseControllerParameters(dwrController, element);
    
    BeanDefinitionHolder holder = new BeanDefinitionHolder(dwrController.getBeanDefinition(), beanName, aliases);
    BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());

    return dwrController.getBeanDefinition();
}
 
Example 9
Project: jetcache   File: CacheAnnotationParser.java   View Source Code Vote up 5 votes
private synchronized void doParse(Element element, ParserContext parserContext) {
    String[] basePackages = StringUtils.tokenizeToStringArray(element.getAttribute("base-package"), ",; \t\n");
    AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
    if (!parserContext.getRegistry().containsBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME)) {
        Object eleSource = parserContext.extractSource(element);

        RootBeanDefinition configMapDef = new RootBeanDefinition(ConcurrentHashMap.class);
        configMapDef.setSource(eleSource);
        configMapDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        String configMapName = parserContext.getReaderContext().registerWithGeneratedName(configMapDef);

        RootBeanDefinition interceptorDef = new RootBeanDefinition(JetCacheInterceptor.class);
        interceptorDef.setSource(eleSource);
        interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        interceptorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
        String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);

        RootBeanDefinition advisorDef = new RootBeanDefinition(CacheAdvisor.class);
        advisorDef.setSource(eleSource);
        advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("adviceBeanName", interceptorName));
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("basePackages", basePackages));
        parserContext.getRegistry().registerBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME, advisorDef);

        CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
                eleSource);
        compositeDef.addNestedComponent(new BeanComponentDefinition(configMapDef, configMapName));
        compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
        compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheAdvisor.CACHE_ADVISOR_BEAN_NAME));
        parserContext.registerComponent(compositeDef);
    }
}
 
Example 10
Project: azeroth   File: MybatisInterceptor.java   View Source Code Vote up 5 votes
public void setInterceptorHandlers(String interceptorHandlers) {
    String[] handlerNames = StringUtils.tokenizeToStringArray(interceptorHandlers,
            ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);

    for (String name : handlerNames) {
        if (CacheHandler.NAME.equals(name)) {
            this.interceptorHandlers.add(new CacheHandler());
            cacheEnabled = true;
        } else if (RwRouteHandler.NAME.equals(name)) {
            this.interceptorHandlers.add(new RwRouteHandler());
            rwRouteEnabled = true;
        } else if (DatabaseRouteHandler.NAME.equals(name)) {
            this.interceptorHandlers.add(new DatabaseRouteHandler());
            dbShardEnabled = true;
        } else if (PaginationHandler.NAME.equals(name)) {
            this.interceptorHandlers.add(new PaginationHandler());
        }
    }
    //排序
    Collections.sort(this.interceptorHandlers, new Comparator<InterceptorHandler>() {
        @Override
        public int compare(InterceptorHandler o1, InterceptorHandler o2) {
            return Integer.compare(o1.interceptorOrder(), o2.interceptorOrder());
        }
    });

}
 
Example 11
Project: lams   File: AspectJAdviceParameterNameDiscoverer.java   View Source Code Vote up 5 votes
/**
 * Given an args pointcut body (could be {@code args} or {@code at_args}),
 * add any candidate variable names to the given list.
 */
private void maybeExtractVariableNamesFromArgs(String argsSpec, List<String> varNames) {
	if (argsSpec == null) {
		return;
	}
	String[] tokens = StringUtils.tokenizeToStringArray(argsSpec, ",");
	for (int i = 0; i < tokens.length; i++) {
		tokens[i] = StringUtils.trimWhitespace(tokens[i]);
		String varName = maybeExtractVariableName(tokens[i]);
		if (varName != null) {
			varNames.add(varName);
		}
	}
}
 
Example 12
Project: lams   File: AspectJAdviceParameterNameDiscoverer.java   View Source Code Vote up 5 votes
/**
 * Match up args against unbound arguments of primitive types
 */
private void maybeBindPrimitiveArgsFromPointcutExpression() {
	int numUnboundPrimitives = countNumberOfUnboundPrimitiveArguments();
	if (numUnboundPrimitives > 1) {
		throw new AmbiguousBindingException("Found '" + numUnboundPrimitives +
				"' unbound primitive arguments with no way to distinguish between them.");
	}
	if (numUnboundPrimitives == 1) {
		// Look for arg variable and bind it if we find exactly one...
		List<String> varNames = new ArrayList<String>();
		String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
		for (int i = 0; i < tokens.length; i++) {
			if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
				PointcutBody body = getPointcutBody(tokens, i);
				i += body.numTokensConsumed;
				maybeExtractVariableNamesFromArgs(body.text, varNames);
			}
		}
		if (varNames.size() > 1) {
			throw new AmbiguousBindingException("Found " + varNames.size() +
					" candidate variable names but only one candidate binding slot when matching primitive args");
		}
		else if (varNames.size() == 1) {
			// 1 primitive arg, and one candidate...
			for (int i = 0; i < this.argumentTypes.length; i++) {
				if (isUnbound(i) && this.argumentTypes[i].isPrimitive()) {
					bindParameterName(i, varNames.get(0));
					break;
				}
			}
		}
	}
}
 
Example 13
Project: azeroth   File: Level1CacheSupport.java   View Source Code Vote up 5 votes
public void setCacheNames(String cacheNames) {
    if (org.apache.commons.lang3.StringUtils.isBlank(cacheNames)) {
        return;
    }
    String[] tmpcacheNames = StringUtils.tokenizeToStringArray(cacheNames,
            ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);
    this.cacheNames = new ArrayList<>(Arrays.asList(tmpcacheNames));
}
 
Example 14
Project: agile-wroking-backend   File: WebTokenHandlerInterceptor.java   View Source Code Vote up 4 votes
@Value("${web.token.ignore.uri.pattern}")
public void setIgnoreUripattern(String ignoreUripattern) {
	if (!StringUtils.isEmpty(ignoreUripattern))
		ignoreUriPatterns = StringUtils.tokenizeToStringArray(ignoreUripattern, ",");
}
 
Example 15
Project: gemini.blueprint   File: BlueprintParser.java   View Source Code Vote up 4 votes
/**
 * Parses the supplied <code>&lt;bean&gt;</code> element. May return <code>null</code> if there were errors during
 * parse. Errors are reported to the {@link org.springframework.beans.factory.parsing.ProblemReporter}.
 */
private BeanDefinitionHolder parseComponentDefinitionElement(Element ele, BeanDefinition containingBean) {

	// extract bean name
	String id = ele.getAttribute(BeanDefinitionParserDelegate.ID_ATTRIBUTE);
	String nameAttr = ele.getAttribute(BeanDefinitionParserDelegate.NAME_ATTRIBUTE);

	List<String> aliases = new ArrayList<String>(4);
	if (StringUtils.hasLength(nameAttr)) {
		String[] nameArr =
				StringUtils.tokenizeToStringArray(nameAttr, BeanDefinitionParserDelegate.MULTI_VALUE_ATTRIBUTE_DELIMITERS);
		aliases.addAll(Arrays.asList(nameArr));
	}

	String beanName = id;

	if (!StringUtils.hasText(beanName) && !aliases.isEmpty()) {
		beanName = (String) aliases.remove(0);
		if (log.isDebugEnabled()) {
			log.debug("No XML 'id' specified - using '" + beanName + "' as bean name and " + aliases
					+ " as aliases");
		}
	}

	if (containingBean == null) {

		if (checkNameUniqueness(beanName, aliases, usedNames)) {
			error("Bean name '" + beanName + "' is already used in this file", ele);
		}

		if (ParsingUtils.isReservedName(beanName, ele, parserContext)) {
			error("Blueprint reserved name '" + beanName + "' cannot be used", ele);
		}
	}

	AbstractBeanDefinition beanDefinition = parseBeanDefinitionElement(ele, beanName, containingBean);
	if (beanDefinition != null) {
		if (!StringUtils.hasText(beanName)) {
			try {
				if (containingBean != null) {
					beanName =
							ParsingUtils.generateBlueprintBeanName(beanDefinition, parserContext.getRegistry(),
									true);
				} else {
					beanName =
							ParsingUtils.generateBlueprintBeanName(beanDefinition, parserContext.getRegistry(),
									false);
					// TODO: should we support 2.0 behaviour (see below):
					// 
					// Register an alias for the plain bean class name, if still possible,
					// if the generator returned the class name plus a suffix.
					// This is expected for Spring 1.2/2.0 backwards compatibility.
				}
				if (log.isDebugEnabled()) {
					log.debug("Neither XML 'id' nor 'name' specified - " + "using generated bean name [" + beanName
							+ "]");
				}
			} catch (Exception ex) {
				error(ex.getMessage(), ele, ex);
				return null;
			}
		}
		return new BeanDefinitionHolder(beanDefinition, beanName);
	}

	return null;
}
 
Example 16
Project: spring-cloud-dashboard   File: DataFlowServerConfiguration.java   View Source Code Vote up 4 votes
private String getH2Port(String url) {
	String[] tokens = StringUtils.tokenizeToStringArray(url, ":");
	Assert.isTrue(tokens.length >= 5, "URL not properly formatted");
	return tokens[4].substring(0, tokens[4].indexOf("/"));
}
 
Example 17
Project: spring-cloud-netflix-zuul-websocket   File: WebSocketMessageAccessor.java   View Source Code Vote up 4 votes
public static WebSocketMessageAccessor create(String message) {
	WebSocketMessageAccessor accessor = new WebSocketMessageAccessor();
	accessor.messageComponents = StringUtils.tokenizeToStringArray(message, "\n");
	return accessor;
}
 
Example 18
Project: lams   File: BeanDefinitionParserDelegate.java   View Source Code Vote up 4 votes
/**
 * Parses the supplied {@code &lt;bean&gt;} element. May return {@code null}
 * if there were errors during parse. Errors are reported to the
 * {@link org.springframework.beans.factory.parsing.ProblemReporter}.
 */
public BeanDefinitionHolder parseBeanDefinitionElement(Element ele, BeanDefinition containingBean) {
	String id = ele.getAttribute(ID_ATTRIBUTE);
	String nameAttr = ele.getAttribute(NAME_ATTRIBUTE);

	List<String> aliases = new ArrayList<String>();
	if (StringUtils.hasLength(nameAttr)) {
		String[] nameArr = StringUtils.tokenizeToStringArray(nameAttr, MULTI_VALUE_ATTRIBUTE_DELIMITERS);
		aliases.addAll(Arrays.asList(nameArr));
	}

	String beanName = id;
	if (!StringUtils.hasText(beanName) && !aliases.isEmpty()) {
		beanName = aliases.remove(0);
		if (logger.isDebugEnabled()) {
			logger.debug("No XML 'id' specified - using '" + beanName +
					"' as bean name and " + aliases + " as aliases");
		}
	}

	if (containingBean == null) {
		checkNameUniqueness(beanName, aliases, ele);
	}

	AbstractBeanDefinition beanDefinition = parseBeanDefinitionElement(ele, beanName, containingBean);
	if (beanDefinition != null) {
		if (!StringUtils.hasText(beanName)) {
			try {
				if (containingBean != null) {
					beanName = BeanDefinitionReaderUtils.generateBeanName(
							beanDefinition, this.readerContext.getRegistry(), true);
				}
				else {
					beanName = this.readerContext.generateBeanName(beanDefinition);
					// Register an alias for the plain bean class name, if still possible,
					// if the generator returned the class name plus a suffix.
					// This is expected for Spring 1.2/2.0 backwards compatibility.
					String beanClassName = beanDefinition.getBeanClassName();
					if (beanClassName != null &&
							beanName.startsWith(beanClassName) && beanName.length() > beanClassName.length() &&
							!this.readerContext.getRegistry().isBeanNameInUse(beanClassName)) {
						aliases.add(beanClassName);
					}
				}
				if (logger.isDebugEnabled()) {
					logger.debug("Neither XML 'id' nor 'name' specified - " +
							"using generated bean name [" + beanName + "]");
				}
			}
			catch (Exception ex) {
				error(ex.getMessage(), ele);
				return null;
			}
		}
		String[] aliasesArray = StringUtils.toStringArray(aliases);
		return new BeanDefinitionHolder(beanDefinition, beanName, aliasesArray);
	}

	return null;
}
 
Example 19
Project: lams   File: AspectJAdviceParameterNameDiscoverer.java   View Source Code Vote up 4 votes
private void maybeBindReferencePointcutParameter() {
	if (this.numberOfRemainingUnboundArguments > 1) {
		throw new AmbiguousBindingException("Still " + this.numberOfRemainingUnboundArguments
				+ " unbound args at reference pointcut binding stage, with no way to determine between them");
	}

	List<String> varNames = new ArrayList<String>();
	String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
	for (int i = 0; i < tokens.length; i++) {
		String toMatch = tokens[i];
		if (toMatch.startsWith("!")) {
			toMatch = toMatch.substring(1);
		}
		int firstParenIndex = toMatch.indexOf("(");
		if (firstParenIndex != -1) {
			toMatch = toMatch.substring(0, firstParenIndex);
		}
		else {
			if (tokens.length < i + 2) {
				// no "(" and nothing following
				continue;
			}
			else {
				String nextToken = tokens[i + 1];
				if (nextToken.charAt(0) != '(') {
					// next token is not "(" either, can't be a pc...
					continue;
				}
			}

		}

		// eat the body
		PointcutBody body = getPointcutBody(tokens, i);
		i += body.numTokensConsumed;

		if (!nonReferencePointcutTokens.contains(toMatch)) {
			// then it could be a reference pointcut
			String varName = maybeExtractVariableName(body.text);
			if (varName != null) {
				varNames.add(varName);
			}
		}
	}

	if (varNames.size() > 1) {
		throw new AmbiguousBindingException("Found " + varNames.size() +
				" candidate reference pointcut variables but only one unbound argument slot");
	}
	else if (varNames.size() == 1) {
		for (int j = 0; j < this.parameterNameBindings.length; j++) {
			if (isUnbound(j)) {
				bindParameterName(j, varNames.get(0));
				break;
			}
		}
	}
	// else varNames.size must be 0 and we have nothing to bind.
}
 
Example 20
Project: azeroth   File: JedisProviderFactoryBean.java   View Source Code Vote up 4 votes
/**
 *
 */
private void registerRedisProvier() {
    String beanName = getGroup() + REDIS_PROVIDER_SUFFIX;
    if (context.containsBean(beanName)) {
        throw new RuntimeException("已包含group为[" + this.group + "]的缓存实例");
    }

    String[] servers = StringUtils.tokenizeToStringArray(this.servers,
            ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);

    //检查ip和port格式
    for (String server : servers) {
        if (!pattern.matcher(server).matches()) {
            throw new RuntimeException("参数servers:" + this.servers + "错误");
        }
    }

    Class<?> beanClass = null;
    if (JedisStandaloneProvider.MODE.equalsIgnoreCase(mode)) {
        beanClass = JedisStandaloneProvider.class;
    } else if (JedisClusterProvider.MODE.equalsIgnoreCase(mode)) {
        beanClass = JedisClusterProvider.class;
    } else if (JedisSentinelProvider.MODE.equalsIgnoreCase(mode)) {
        beanClass = JedisSentinelProvider.class;
        //
        Validate.notBlank(masterName, "Sentinel模式[masterName]参数 required");
    } else {
        throw new RuntimeException("参数mode:" + this.mode + "不支持");
    }

    DefaultListableBeanFactory acf = (DefaultListableBeanFactory) context
            .getAutowireCapableBeanFactory();
    BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder
            .genericBeanDefinition(beanClass);
    beanDefinitionBuilder.addConstructorArgValue(getGroup())//
            .addConstructorArgValue(jedisPoolConfig)//
            .addConstructorArgValue(servers)//
            .addConstructorArgValue(timeout);//

    if (JedisStandaloneProvider.MODE.equalsIgnoreCase(mode)
            || JedisSentinelProvider.MODE.equalsIgnoreCase(mode)) {
        beanDefinitionBuilder
                .addConstructorArgValue(org.apache.commons.lang3.StringUtils.trimToNull(password))//
                .addConstructorArgValue(database)//
                .addConstructorArgValue(clientName);
    }

    if (JedisSentinelProvider.MODE.equalsIgnoreCase(mode)) {
        beanDefinitionBuilder.addConstructorArgValue(masterName);
    }

    acf.registerBeanDefinition(beanName, beanDefinitionBuilder.getRawBeanDefinition());
    //
    logger.info("register JedisProvider OK,Class:{},beanName:{}", beanClass.getSimpleName(),
            beanName);
}