{"action":"created","comment":{"url":"https://api.github.com/repos/spring-projects/spring-batch/pulls/comments/200674526","pull_request_review_id":135040475,"id":200674526,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDY3NDUyNg==","diff_hunk":"@@ -0,0 +1,61 @@\n+/*\n+ * Copyright 2018 the original author or authors.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *       http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.springframework.batch.item.validator;\n+\n+import javax.validation.Validator;\n+\n+import org.apache.shiro.util.Assert;\n+\n+import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;\n+import org.springframework.validation.beanvalidation.SpringValidatorAdapter;\n+\n+/**\n+ * A {@link ValidatingItemProcessor} that uses the Bean Validation API (JSR-303)\n+ * to validate items.\n+ *\n+ * @param <T> type of items to validate\n+ * @author Mahmoud Ben Hassine\n+ * @since 4.1\n+ */\n+public class BeanValidatingItemProcessor<T> extends ValidatingItemProcessor<T> {\n+\n+\t/**\n+\t * Create a new instance of {@link BeanValidatingItemProcessor} with the\n+\t * default configuration.\n+\t * @throws Exception If unable to configure the Bean Validation infrastructure\n+\t */\n+\tpublic BeanValidatingItemProcessor() throws Exception {\n+\t\tthis(new LocalValidatorFactoryBean());\n+\t}\n+\n+\t/**\n+\t * Create a new instance of {@link BeanValidatingItemProcessor}.\n+\t * @param localValidatorFactoryBean used to configure the Bean Validation validator\n+\t * @throws Exception If unable to configure the Bean Validation infrastructure\n+\t */\n+\tpublic BeanValidatingItemProcessor(LocalValidatorFactoryBean localValidatorFactoryBean) throws Exception {\n+\t\tsuper();\n+\t\tAssert.notNull(localValidatorFactoryBean, \"localValidatorFactoryBean must not be null\");\n+\t\tlocalValidatorFactoryBean.afterPropertiesSet();\n+\t\tValidator validator = localValidatorFactoryBean.getValidator();\n+\t\tSpringValidatorAdapter springValidatorAdapter = new SpringValidatorAdapter(validator);\n+\t\tSpringValidator<T> springValidator = new SpringValidator<>();\n+\t\tspringValidator.setValidator(springValidatorAdapter);\n+\t\tspringValidator.afterPropertiesSet();","path":"spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/BeanValidatingItemProcessor.java","position":58,"original_position":58,"commit_id":"941d82443cdd6fdc182341b07459dfd791ddb67e","original_commit_id":"941d82443cdd6fdc182341b07459dfd791ddb67e","user":{"login":"mminella","id":630743,"node_id":"MDQ6VXNlcjYzMDc0Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/630743?v=4","gravatar_id":"","url":"https://api.github.com/users/mminella","html_url":"https://github.com/mminella","followers_url":"https://api.github.com/users/mminella/followers","following_url":"https://api.github.com/users/mminella/following{/other_user}","gists_url":"https://api.github.com/users/mminella/gists{/gist_id}","starred_url":"https://api.github.com/users/mminella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mminella/subscriptions","organizations_url":"https://api.github.com/users/mminella/orgs","repos_url":"https://api.github.com/users/mminella/repos","events_url":"https://api.github.com/users/mminella/events{/privacy}","received_events_url":"https://api.github.com/users/mminella/received_events","type":"User","site_admin":false},"body":"Since the `ValidatingItemProcessor` implements `IntializingBean`, this `afterPropertiesSet` should be called in an override of the parent's method to honor the lifecycle.","created_at":"2018-07-06T14:41:11Z","updated_at":"2018-07-06T14:43:35Z","html_url":"https://github.com/spring-projects/spring-batch/pull/617#discussion_r200674526","pull_request_url":"https://api.github.com/repos/spring-projects/spring-batch/pulls/617","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-batch/pulls/comments/200674526"},"html":{"href":"https://github.com/spring-projects/spring-batch/pull/617#discussion_r200674526"},"pull_request":{"href":"https://api.github.com/repos/spring-projects/spring-batch/pulls/617"}}},"pull_request":{"url":"https://api.github.com/repos/spring-projects/spring-batch/pulls/617","id":197441298,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3NDQxMjk4","html_url":"https://github.com/spring-projects/spring-batch/pull/617","diff_url":"https://github.com/spring-projects/spring-batch/pull/617.diff","patch_url":"https://github.com/spring-projects/spring-batch/pull/617.patch","issue_url":"https://api.github.com/repos/spring-projects/spring-batch/issues/617","number":617,"state":"open","locked":false,"title":"Add a validator implementation based on the Bean Validation API","user":{"login":"benas","id":1210553,"node_id":"MDQ6VXNlcjEyMTA1NTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1210553?v=4","gravatar_id":"","url":"https://api.github.com/users/benas","html_url":"https://github.com/benas","followers_url":"https://api.github.com/users/benas/followers","following_url":"https://api.github.com/users/benas/following{/other_user}","gists_url":"https://api.github.com/users/benas/gists{/gist_id}","starred_url":"https://api.github.com/users/benas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benas/subscriptions","organizations_url":"https://api.github.com/users/benas/orgs","repos_url":"https://api.github.com/users/benas/repos","events_url":"https://api.github.com/users/benas/events{/privacy}","received_events_url":"https://api.github.com/users/benas/received_events","type":"User","site_admin":false},"body":"This PR resolves [BATCH-2690](https://jira.spring.io/browse/BATCH-2690).","created_at":"2018-06-26T14:23:41Z","updated_at":"2018-07-06T14:43:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c8f4e1a354723572de67bf521f106895e5a612f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":896810429,"node_id":"MDU6TGFiZWw4OTY4MTA0Mjk=","url":"https://api.github.com/repos/spring-projects/spring-batch/labels/ready-to-review","name":"ready-to-review","color":"0052cc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/spring-projects/spring-batch/pulls/617/commits","review_comments_url":"https://api.github.com/repos/spring-projects/spring-batch/pulls/617/comments","review_comment_url":"https://api.github.com/repos/spring-projects/spring-batch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spring-projects/spring-batch/issues/617/comments","statuses_url":"https://api.github.com/repos/spring-projects/spring-batch/statuses/941d82443cdd6fdc182341b07459dfd791ddb67e","head":{"label":"benas:BATCH-2690","ref":"BATCH-2690","sha":"941d82443cdd6fdc182341b07459dfd791ddb67e","user":{"login":"benas","id":1210553,"node_id":"MDQ6VXNlcjEyMTA1NTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1210553?v=4","gravatar_id":"","url":"https://api.github.com/users/benas","html_url":"https://github.com/benas","followers_url":"https://api.github.com/users/benas/followers","following_url":"https://api.github.com/users/benas/following{/other_user}","gists_url":"https://api.github.com/users/benas/gists{/gist_id}","starred_url":"https://api.github.com/users/benas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benas/subscriptions","organizations_url":"https://api.github.com/users/benas/orgs","repos_url":"https://api.github.com/users/benas/repos","events_url":"https://api.github.com/users/benas/events{/privacy}","received_events_url":"https://api.github.com/users/benas/received_events","type":"User","site_admin":false},"repo":{"id":116242052,"node_id":"MDEwOlJlcG9zaXRvcnkxMTYyNDIwNTI=","name":"spring-batch","full_name":"benas/spring-batch","owner":{"login":"benas","id":1210553,"node_id":"MDQ6VXNlcjEyMTA1NTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1210553?v=4","gravatar_id":"","url":"https://api.github.com/users/benas","html_url":"https://github.com/benas","followers_url":"https://api.github.com/users/benas/followers","following_url":"https://api.github.com/users/benas/following{/other_user}","gists_url":"https://api.github.com/users/benas/gists{/gist_id}","starred_url":"https://api.github.com/users/benas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benas/subscriptions","organizations_url":"https://api.github.com/users/benas/orgs","repos_url":"https://api.github.com/users/benas/repos","events_url":"https://api.github.com/users/benas/events{/privacy}","received_events_url":"https://api.github.com/users/benas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benas/spring-batch","description":"Spring Batch is a framework for writing offline and batch applications using Spring and Java","fork":true,"url":"https://api.github.com/repos/benas/spring-batch","forks_url":"https://api.github.com/repos/benas/spring-batch/forks","keys_url":"https://api.github.com/repos/benas/spring-batch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benas/spring-batch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benas/spring-batch/teams","hooks_url":"https://api.github.com/repos/benas/spring-batch/hooks","issue_events_url":"https://api.github.com/repos/benas/spring-batch/issues/events{/number}","events_url":"https://api.github.com/repos/benas/spring-batch/events","assignees_url":"https://api.github.com/repos/benas/spring-batch/assignees{/user}","branches_url":"https://api.github.com/repos/benas/spring-batch/branches{/branch}","tags_url":"https://api.github.com/repos/benas/spring-batch/tags","blobs_url":"https://api.github.com/repos/benas/spring-batch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benas/spring-batch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benas/spring-batch/git/refs{/sha}","trees_url":"https://api.github.com/repos/benas/spring-batch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benas/spring-batch/statuses/{sha}","languages_url":"https://api.github.com/repos/benas/spring-batch/languages","stargazers_url":"https://api.github.com/repos/benas/spring-batch/stargazers","contributors_url":"https://api.github.com/repos/benas/spring-batch/contributors","subscribers_url":"https://api.github.com/repos/benas/spring-batch/subscribers","subscription_url":"https://api.github.com/repos/benas/spring-batch/subscription","commits_url":"https://api.github.com/repos/benas/spring-batch/commits{/sha}","git_commits_url":"https://api.github.com/repos/benas/spring-batch/git/commits{/sha}","comments_url":"https://api.github.com/repos/benas/spring-batch/comments{/number}","issue_comment_url":"https://api.github.com/repos/benas/spring-batch/issues/comments{/number}","contents_url":"https://api.github.com/repos/benas/spring-batch/contents/{+path}","compare_url":"https://api.github.com/repos/benas/spring-batch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benas/spring-batch/merges","archive_url":"https://api.github.com/repos/benas/spring-batch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benas/spring-batch/downloads","issues_url":"https://api.github.com/repos/benas/spring-batch/issues{/number}","pulls_url":"https://api.github.com/repos/benas/spring-batch/pulls{/number}","milestones_url":"https://api.github.com/repos/benas/spring-batch/milestones{/number}","notifications_url":"https://api.github.com/repos/benas/spring-batch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benas/spring-batch/labels{/name}","releases_url":"https://api.github.com/repos/benas/spring-batch/releases{/id}","deployments_url":"https://api.github.com/repos/benas/spring-batch/deployments","created_at":"2018-01-04T09:38:50Z","updated_at":"2018-07-06T07:43:09Z","pushed_at":"2018-07-06T07:44:39Z","git_url":"git://github.com/benas/spring-batch.git","ssh_url":"git@github.com:benas/spring-batch.git","clone_url":"https://github.com/benas/spring-batch.git","svn_url":"https://github.com/benas/spring-batch","homepage":"http://projects.spring.io/spring-batch/","size":88376,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spring-projects:master","ref":"master","sha":"547533fab072289c062916e51c589de36ea3dfe2","user":{"login":"spring-projects","id":317776,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzc3Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/317776?v=4","gravatar_id":"","url":"https://api.github.com/users/spring-projects","html_url":"https://github.com/spring-projects","followers_url":"https://api.github.com/users/spring-projects/followers","following_url":"https://api.github.com/users/spring-projects/following{/other_user}","gists_url":"https://api.github.com/users/spring-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-projects/subscriptions","organizations_url":"https://api.github.com/users/spring-projects/orgs","repos_url":"https://api.github.com/users/spring-projects/repos","events_url":"https://api.github.com/users/spring-projects/events{/privacy}","received_events_url":"https://api.github.com/users/spring-projects/received_events","type":"Organization","site_admin":false},"repo":{"id":1089149,"node_id":"MDEwOlJlcG9zaXRvcnkxMDg5MTQ5","name":"spring-batch","full_name":"spring-projects/spring-batch","owner":{"login":"spring-projects","id":317776,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzc3Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/317776?v=4","gravatar_id":"","url":"https://api.github.com/users/spring-projects","html_url":"https://github.com/spring-projects","followers_url":"https://api.github.com/users/spring-projects/followers","following_url":"https://api.github.com/users/spring-projects/following{/other_user}","gists_url":"https://api.github.com/users/spring-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-projects/subscriptions","organizations_url":"https://api.github.com/users/spring-projects/orgs","repos_url":"https://api.github.com/users/spring-projects/repos","events_url":"https://api.github.com/users/spring-projects/events{/privacy}","received_events_url":"https://api.github.com/users/spring-projects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spring-projects/spring-batch","description":"Spring Batch is a framework for writing offline and batch applications using Spring and Java","fork":false,"url":"https://api.github.com/repos/spring-projects/spring-batch","forks_url":"https://api.github.com/repos/spring-projects/spring-batch/forks","keys_url":"https://api.github.com/repos/spring-projects/spring-batch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spring-projects/spring-batch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spring-projects/spring-batch/teams","hooks_url":"https://api.github.com/repos/spring-projects/spring-batch/hooks","issue_events_url":"https://api.github.com/repos/spring-projects/spring-batch/issues/events{/number}","events_url":"https://api.github.com/repos/spring-projects/spring-batch/events","assignees_url":"https://api.github.com/repos/spring-projects/spring-batch/assignees{/user}","branches_url":"https://api.github.com/repos/spring-projects/spring-batch/branches{/branch}","tags_url":"https://api.github.com/repos/spring-projects/spring-batch/tags","blobs_url":"https://api.github.com/repos/spring-projects/spring-batch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spring-projects/spring-batch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spring-projects/spring-batch/git/refs{/sha}","trees_url":"https://api.github.com/repos/spring-projects/spring-batch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spring-projects/spring-batch/statuses/{sha}","languages_url":"https://api.github.com/repos/spring-projects/spring-batch/languages","stargazers_url":"https://api.github.com/repos/spring-projects/spring-batch/stargazers","contributors_url":"https://api.github.com/repos/spring-projects/spring-batch/contributors","subscribers_url":"https://api.github.com/repos/spring-projects/spring-batch/subscribers","subscription_url":"https://api.github.com/repos/spring-projects/spring-batch/subscription","commits_url":"https://api.github.com/repos/spring-projects/spring-batch/commits{/sha}","git_commits_url":"https://api.github.com/repos/spring-projects/spring-batch/git/commits{/sha}","comments_url":"https://api.github.com/repos/spring-projects/spring-batch/comments{/number}","issue_comment_url":"https://api.github.com/repos/spring-projects/spring-batch/issues/comments{/number}","contents_url":"https://api.github.com/repos/spring-projects/spring-batch/contents/{+path}","compare_url":"https://api.github.com/repos/spring-projects/spring-batch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spring-projects/spring-batch/merges","archive_url":"https://api.github.com/repos/spring-projects/spring-batch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spring-projects/spring-batch/downloads","issues_url":"https://api.github.com/repos/spring-projects/spring-batch/issues{/number}","pulls_url":"https://api.github.com/repos/spring-projects/spring-batch/pulls{/number}","milestones_url":"https://api.github.com/repos/spring-projects/spring-batch/milestones{/number}","notifications_url":"https://api.github.com/repos/spring-projects/spring-batch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spring-projects/spring-batch/labels{/name}","releases_url":"https://api.github.com/repos/spring-projects/spring-batch/releases{/id}","deployments_url":"https://api.github.com/repos/spring-projects/spring-batch/deployments","created_at":"2010-11-17T17:53:45Z","updated_at":"2018-07-06T10:09:32Z","pushed_at":"2018-07-05T20:57:19Z","git_url":"git://github.com/spring-projects/spring-batch.git","ssh_url":"git@github.com:spring-projects/spring-batch.git","clone_url":"https://github.com/spring-projects/spring-batch.git","svn_url":"https://github.com/spring-projects/spring-batch","homepage":"http://projects.spring.io/spring-batch/","size":87550,"stargazers_count":984,"watchers_count":984,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1037,"mirror_url":null,"archived":false,"open_issues_count":35,"license":null,"forks":1037,"open_issues":35,"watchers":984,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-batch/pulls/617"},"html":{"href":"https://github.com/spring-projects/spring-batch/pull/617"},"issue":{"href":"https://api.github.com/repos/spring-projects/spring-batch/issues/617"},"comments":{"href":"https://api.github.com/repos/spring-projects/spring-batch/issues/617/comments"},"review_comments":{"href":"https://api.github.com/repos/spring-projects/spring-batch/pulls/617/comments"},"review_comment":{"href":"https://api.github.com/repos/spring-projects/spring-batch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spring-projects/spring-batch/pulls/617/commits"},"statuses":{"href":"https://api.github.com/repos/spring-projects/spring-batch/statuses/941d82443cdd6fdc182341b07459dfd791ddb67e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mminella"}}