{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/6228","repository_url":"https://api.github.com/repos/spring-projects/spring-boot","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/6228/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/6228/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/6228/events","html_url":"https://github.com/spring-projects/spring-boot/issues/6228","id":162277079,"number":6228,"title":"Declaring spring-boot-starter-validation dependency should provide MethodValidationPostProcessor bean","user":{"login":"thomasdarimont","id":314690,"avatar_url":"https://avatars.githubusercontent.com/u/314690?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasdarimont","html_url":"https://github.com/thomasdarimont","followers_url":"https://api.github.com/users/thomasdarimont/followers","following_url":"https://api.github.com/users/thomasdarimont/following{/other_user}","gists_url":"https://api.github.com/users/thomasdarimont/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasdarimont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasdarimont/subscriptions","organizations_url":"https://api.github.com/users/thomasdarimont/orgs","repos_url":"https://api.github.com/users/thomasdarimont/repos","events_url":"https://api.github.com/users/thomasdarimont/events{/privacy}","received_events_url":"https://api.github.com/users/thomasdarimont/received_events","type":"User","site_admin":false},"labels":[{"id":293438798,"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/waiting-for-triage","name":"waiting-for-triage","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-25T11:31:41Z","updated_at":"2016-11-06T09:44:15Z","closed_at":null,"body":"I wanted to use bean-validation for parameters of a `@RestController` method.\n\nTurns out that even with the inclusion of the starter-validation dependency:\n\n``` xml\n<dependency>\n    <groupId>org.springframework.boot</groupId>\n    <artifactId>spring-boot-starter-validation</artifactId>\n</dependency>\n```\n\none needs to manually define a `MethodValidationPostProcessor` as shown below.\nIf spring-boot provided such a bean ootb then user's could just work\nwith the annotations like `@Validated` and the JSR-303/349 stuff.\n\n``` java\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.validation.annotation.Validated;\nimport org.springframework.validation.beanvalidation.MethodValidationPostProcessor;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\nimport javax.validation.constraints.Size;\nimport java.util.Map;\n\nimport static java.lang.String.format;\nimport static java.util.Collections.singletonMap;\n\n@SpringBootApplication\npublic class MvcWebApp {\n\n    public static void main(String[] args) {\n        SpringApplication.run(MvcWebApp.class, args);\n    }\n\n    @Bean //this could be provided via auto-configuration\n    MethodValidationPostProcessor methodValidationPostProcessor() {\n        return new MethodValidationPostProcessor();\n    }\n}\n\n@RestController\n@Validated\n@RequestMapping(\"/api\")\nclass HelloResource {\n\n\n    @RequestMapping(\"/greet/{name}\")\n    public Map<String, String> greet(@PathVariable(\"name\") @Size(min = 3, max = 10, message = \"You messed up!\") String name) {\n        return singletonMap(\"greeting\", format(\"Hello %s\", name));\n    }\n}\n```\n"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/258670161","html_url":"https://github.com/spring-projects/spring-boot/issues/6228#issuecomment-258670161","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/6228","id":258670161,"user":{"login":"snicoll","id":490484,"avatar_url":"https://avatars.githubusercontent.com/u/490484?v=3","gravatar_id":"","url":"https://api.github.com/users/snicoll","html_url":"https://github.com/snicoll","followers_url":"https://api.github.com/users/snicoll/followers","following_url":"https://api.github.com/users/snicoll/following{/other_user}","gists_url":"https://api.github.com/users/snicoll/gists{/gist_id}","starred_url":"https://api.github.com/users/snicoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snicoll/subscriptions","organizations_url":"https://api.github.com/users/snicoll/orgs","repos_url":"https://api.github.com/users/snicoll/repos","events_url":"https://api.github.com/users/snicoll/events{/privacy}","received_events_url":"https://api.github.com/users/snicoll/received_events","type":"User","site_admin":false},"created_at":"2016-11-06T09:44:15Z","updated_at":"2016-11-06T09:44:15Z","body":"@michael-simons please use the github reaction feature for simple +1. Thank you."}}
{"actor":{"display_login":"snicoll"}}