Below solution is a shorthand for @Andy Wilkinson's solution, except that it doesn't have to use a separate class or on a @Bean annotated method.


  name: raja
  age: 12
    abcd: 1 
    bcbd: 2
    cdbd: 3

@ConfigurationProperties(prefix = "input")
class SomeComponent {

    private String name;

    private Integer age;

    private HashMap<String, Integer> somedata;

    public HashMap<String, Integer> getSomedata() {
        return somedata;

    public void setSomedata(HashMap<String, Integer> somedata) {
        this.somedata = somedata;


We can club both @Value annotation and @ConfigurationProperties, no issues. But getters and setters are important and @EnableConfigurationProperties is must to have the @ConfigurationProperties to work.

I tried this idea from groovy solution provided by @Szymon Stepniak, thought it will be useful for someone.