Package org.springframework.util

Examples of org.springframework.util.PropertyPlaceholderHelper


    protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException {
        super.processProperties(beanFactoryToProcess, props);
        // store all the spring properties so we can refer to them later
        properties.putAll(props);
        // create helper
        helper = new PropertyPlaceholderHelper(
                configuredPlaceholderPrefix != null ? configuredPlaceholderPrefix : DEFAULT_PLACEHOLDER_PREFIX,
                configuredPlaceholderSuffix != null ? configuredPlaceholderSuffix : DEFAULT_PLACEHOLDER_SUFFIX,
                configuredValueSeparator != null ? configuredValueSeparator : DEFAULT_VALUE_SEPARATOR,
                configuredIgnoreUnresolvablePlaceholders != null ? configuredIgnoreUnresolvablePlaceholders : false);
    }
View Full Code Here


  private PlaceholderResolver resolver;

  public SpelView(String template) {
    this.template = template;
    this.context.addPropertyAccessor(new MapAccessor());
    this.helper = new PropertyPlaceholderHelper("${", "}");
    this.resolver = new PlaceholderResolver() {
      public String resolvePlaceholder(String name) {
        Expression expression = parser.parseExpression(name);
        Object value = expression.getValue(context);
        return value == null ? null : value.toString();
View Full Code Here

        private final PropertyPlaceholderHelper helper;

        private final PropertyPlaceholderHelper.PlaceholderResolver resolver;

        public PlaceholderResolvingStringValueResolver(Properties props) {
            this.helper = new PropertyPlaceholderHelper("${", "}", ":", true);
            this.resolver = new PropertyPlaceholderConfigurerResolver(props);
        }
View Full Code Here

   * with {@link org.springframework.util.PropertyPlaceholderHelper}.
   * Only retained for compatibility with Spring 2.5 extensions.
   */
  @Deprecated
  protected String parseStringValue(String strVal, Properties props, Set<?> visitedPlaceholders) {
    PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper(
        placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders);
    PlaceholderResolver resolver = new PropertyPlaceholderConfigurerResolver(props);
    return helper.replacePlaceholders(strVal, resolver);
  }
View Full Code Here

    private final PropertyPlaceholderHelper helper;

    private final PlaceholderResolver resolver;

    public PlaceholderResolvingStringValueResolver(Properties props) {
      this.helper = new PropertyPlaceholderHelper(
          placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders);
      this.resolver = new PropertyPlaceholderConfigurerResolver(props);
    }
View Full Code Here

    return (this.ignoreUnresolvableNestedPlaceholders ?
        resolvePlaceholders(value) : resolveRequiredPlaceholders(value));
  }

  private PropertyPlaceholderHelper createPlaceholderHelper(boolean ignoreUnresolvablePlaceholders) {
    return new PropertyPlaceholderHelper(this.placeholderPrefix, this.placeholderSuffix,
        this.valueSeparator, ignoreUnresolvablePlaceholders);
  }
View Full Code Here

    private final PropertyPlaceholderHelper helper;

    private final PlaceholderResolver resolver;

    public StaticStringValueResolver(final Map<String, String> values) {
      this.helper = new PropertyPlaceholderHelper("${", "}", ":", false);
      this.resolver = new PlaceholderResolver() {
        @Override
        public String resolvePlaceholder(String placeholderName) {
          return values.get(placeholderName);
        }
View Full Code Here

   * with {@link org.springframework.util.PropertyPlaceholderHelper}.
   * Only retained for compatibility with Spring 2.5 extensions.
   */
  @Deprecated
  protected String parseStringValue(String strVal, Properties props, Set visitedPlaceholders) {
    PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper(
        placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders);
    PlaceholderResolver resolver = new PropertyPlaceholderConfigurerResolver(props);
    return helper.replacePlaceholders(strVal, resolver);
  }
View Full Code Here

    private final PropertyPlaceholderHelper helper;

    private final PlaceholderResolver resolver;

    public PlaceholderResolvingStringValueResolver(Properties props) {
      this.helper = new PropertyPlaceholderHelper(
          placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders);
      this.resolver = new PropertyPlaceholderConfigurerResolver(props);
    }
View Full Code Here

     * @param properties the merged context properties
     */
    public static void processProperties(final Properties properties,
        String placeholderPrefix, String placeholderSuffix)
    {
        PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper(
                placeholderPrefix, placeholderSuffix);
        PropertyPlaceholderHelper.PlaceholderResolver resolver = new PropertyPlaceholderHelper.PlaceholderResolver()
        {
            @Override
            public String resolvePlaceholder(String placeholderName)
            {
                // SYSTEM_PROPERTIES_MODE_OVERRIDE means we look at previously set
                // system properties in preference to properties defined in our file
                String value = System.getProperty(placeholderName);
                if (value == null)
                    value = properties.getProperty(placeholderName);
                return value;
            }
        };

        for (Object key : properties.keySet())
        {
            String propertyName = (String) key;
            // get the value from the map
            String propertyValue = properties.getProperty(propertyName);
            // resolve it against system properties then other properties in the
            // passed-in Properties
            String resolvedValue = helper.replacePlaceholders(propertyValue,
                    resolver);

            // set back into passed-in Properties if changed
            if (!ObjectUtils.nullSafeEquals(propertyValue, resolvedValue))
            {
View Full Code Here

TOP

Related Classes of org.springframework.util.PropertyPlaceholderHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.