Skip to content

Values not loaded from Parameter Store if parameter name contains a digit surrounded with underscores #1573

Description

@Holuo01

Type: Bug

Component: Parameter Store

Describe the bug
When values are being loaded from Prameter Store on app startup, if the parameter name contains a digit surrounded with underscores it will not load from paramstore, instead falling back to the default value, while other parameters are injected correctly:

Image Image

Sample
yaml file:

debug:
  testParams:
    oneNumber:        ${WORD_2_WORD_WORD:placeholder}
    letterNumber:     ${WORD_W2_WORD_WORD:placeholder}
    numberLetter:     ${WORD_2W_WORD_WORD:placeholder}
    singleLetter:     ${WORD_W_WORD_WORD:placeholder}

config class:

package org.myapp.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.Map;

@Configuration
@Getter
@Setter
@ConfigurationProperties(prefix = "debug")
public class DebugConfig {

    private Map<String, String> testParams;
}

service class:

package org.myapp.service.util;

import org.myapp.config.DebugConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class DebugService {

    public DebugService(DebugConfig config) {

        for (String param : config.getTestParams().keySet()) {
            log.info("Value for {}: {}", param, config.getTestParams().get(param));
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions