{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/1415","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/1415/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/1415/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/1415/events","html_url":"https://github.com/spring-projects/spring-boot/issues/1415","id":40762457,"number":1415,"title":"YAML lists cannot be mapped to Sets","user":{"login":"wooder79","id":6256522,"avatar_url":"https://avatars.githubusercontent.com/u/6256522?v=3","gravatar_id":"","url":"https://api.github.com/users/wooder79","html_url":"https://github.com/wooder79","followers_url":"https://api.github.com/users/wooder79/followers","following_url":"https://api.github.com/users/wooder79/following{/other_user}","gists_url":"https://api.github.com/users/wooder79/gists{/gist_id}","starred_url":"https://api.github.com/users/wooder79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wooder79/subscriptions","organizations_url":"https://api.github.com/users/wooder79/orgs","repos_url":"https://api.github.com/users/wooder79/repos","events_url":"https://api.github.com/users/wooder79/events{/privacy}","received_events_url":"https://api.github.com/users/wooder79/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/waiting-for-feedback","name":"waiting-for-feedback","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-08-21T00:50:01Z","updated_at":"2015-05-12T09:06:39Z","closed_at":"2015-05-12T09:06:39Z","body":"I have a YAML application properties file and I'm trying to map a series of items to a `Set`. This appears to be impossible given the Spring Beans code that processes the properties, but the documentation tells a different story.\r\n\r\nYAML:\r\n```\r\ntest:\r\n  - \"value\"\r\n```\r\n\r\nCode:\r\n```\r\n@ConfigurationProperties\r\npublic class MyTest {\r\n\r\n    private Set<String> test;\r\n\r\n    public void setTest(Set<String> test) {\r\n        this.test = test;\r\n    }\r\n\r\n    public Set<String> getTest() {\r\n        return this.test;\r\n    }\r\n}\r\n```\r\n\r\nThe `spring-boot` [documentation](http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html) states:\r\n>To bind to properties like that using the Spring DataBinder utilities (which is what @ConfigurationProperties does) you need to have a property in the target bean of type java.util.List **(or Set)** and you either need to provide a setter, or initialize it with a mutable value, e.g. this will bind to the properties above\r\n\r\nHowever, `Set` is not supported. If you attempt to map a YAML property to a `Set`, you'll get an exception similar to the following:\r\n```\r\nProperty referenced in indexed property path 'test[0]' is neither an array nor a List nor a Map; returned value was [value]\r\n```\r\n\r\nThe documentation should be corrected on this point."},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/101203790","html_url":"https://github.com/spring-projects/spring-boot/issues/1415#issuecomment-101203790","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/1415","id":101203790,"user":{"login":"wilkinsona","id":914682,"avatar_url":"https://avatars.githubusercontent.com/u/914682?v=3","gravatar_id":"","url":"https://api.github.com/users/wilkinsona","html_url":"https://github.com/wilkinsona","followers_url":"https://api.github.com/users/wilkinsona/followers","following_url":"https://api.github.com/users/wilkinsona/following{/other_user}","gists_url":"https://api.github.com/users/wilkinsona/gists{/gist_id}","starred_url":"https://api.github.com/users/wilkinsona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilkinsona/subscriptions","organizations_url":"https://api.github.com/users/wilkinsona/orgs","repos_url":"https://api.github.com/users/wilkinsona/repos","events_url":"https://api.github.com/users/wilkinsona/events{/privacy}","received_events_url":"https://api.github.com/users/wilkinsona/received_events","type":"User","site_admin":false},"created_at":"2015-05-12T09:06:39Z","updated_at":"2015-05-12T09:06:39Z","body":"Closing due to lack of response. Please comment again and we can reopen the issue if you're still having trouble."}}