version:2.2.1.RELEASE

I created an application.yml with the configuration:

yaml-config:
  person-map:
    张三: 张三

Then I created a class to map this configuration:

@Data
@Configuration
@ConfigurationProperties("yaml-config")
public class YamlConfig {
    private Map<String, String> personMap;
}

Then i start springboot with error message:

Description:

Failed to bind properties under 'yaml-config.person-map' to java.util.Map<java.lang.String, java.lang.String>:

    Reason: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]

When I changed '张三' to 'a张三', the startup was successful

yaml-config:
  person-map:
    a张三: 张三

Why does the key beginning with Chinese fail to parse?

Comment From: wilkinsona

Please see the documentation on relaxed binding:

When binding to Map properties, if the key contains anything other than lowercase alpha-numeric characters or -, you need to use the bracket notation so that the original value is preserved. If the key is not surrounded by [], any characters that are not alpha-numeric or - are removed.

In your case, the key should be "[a张三]"

If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Comment From: chentiefeng

Sorry for not seeing the documentation, thanks