{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4752","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4752/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4752/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4752/events","html_url":"https://github.com/spring-projects/spring-boot/issues/4752","id":121674396,"number":4752,"title":"New Return Type in BatchAutoConfiguration prevents overwritting with own ExitCodeGenerator","user":{"login":"HansjoergW","id":16253487,"avatar_url":"https://avatars.githubusercontent.com/u/16253487?v=3","gravatar_id":"","url":"https://api.github.com/users/HansjoergW","html_url":"https://github.com/HansjoergW","followers_url":"https://api.github.com/users/HansjoergW/followers","following_url":"https://api.github.com/users/HansjoergW/following{/other_user}","gists_url":"https://api.github.com/users/HansjoergW/gists{/gist_id}","starred_url":"https://api.github.com/users/HansjoergW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HansjoergW/subscriptions","organizations_url":"https://api.github.com/users/HansjoergW/orgs","repos_url":"https://api.github.com/users/HansjoergW/repos","events_url":"https://api.github.com/users/HansjoergW/events{/privacy}","received_events_url":"https://api.github.com/users/HansjoergW/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/regression","name":"regression","color":"eb6420"}],"state":"open","locked":false,"assignee":{"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},"milestone":{"url":"https://api.github.com/repos/spring-projects/spring-boot/milestones/49","html_url":"https://github.com/spring-projects/spring-boot/milestones/1.3.1","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/milestones/49/labels","id":1396509,"number":49,"title":"1.3.1","description":"","creator":{"login":"philwebb","id":519772,"avatar_url":"https://avatars.githubusercontent.com/u/519772?v=3","gravatar_id":"","url":"https://api.github.com/users/philwebb","html_url":"https://github.com/philwebb","followers_url":"https://api.github.com/users/philwebb/followers","following_url":"https://api.github.com/users/philwebb/following{/other_user}","gists_url":"https://api.github.com/users/philwebb/gists{/gist_id}","starred_url":"https://api.github.com/users/philwebb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philwebb/subscriptions","organizations_url":"https://api.github.com/users/philwebb/orgs","repos_url":"https://api.github.com/users/philwebb/repos","events_url":"https://api.github.com/users/philwebb/events{/privacy}","received_events_url":"https://api.github.com/users/philwebb/received_events","type":"User","site_admin":false},"open_issues":45,"closed_issues":76,"state":"open","created_at":"2015-11-05T22:07:18Z","updated_at":"2015-12-11T10:08:09Z","due_on":"2015-12-16T08:00:00Z","closed_at":null},"comments":3,"created_at":"2015-12-11T09:52:32Z","updated_at":"2015-12-11T11:00:04Z","closed_at":null,"body":"\r\nIn spring-boot-autoconfigure Version 1.3.0, the return type in class BatchAutoConfigure changed for method jobExecutionExitCodeGenerator().\r\nOld Version 1.2.5\r\n```java\r\n@Bean\r\n@ConditionalOnMissingBean\r\npublic ExitCodeGenerator jobExecutionExitCodeGenerator() {\r\n    return new JobExecutionExitCodeGenerator();\r\n}\r\n```\r\nnew Version 1.3.0\r\n````java\r\n@Bean\r\n@ConditionalOnMissingBean\r\npublic JobExecutionExitCodeGenerator jobExecutionExitCodeGenerator() {\r\n    return new JobExecutionExitCodeGenerator();\r\n}\r\n```\r\nIn order to define your own ExitCodeGenerator, it was possible to simply instantiate a Bean that iplemented ExitCodeGenerator, e.g.\r\n```java\r\n@Bean\r\npublic ExitCodeGenerator anotherExitCodeGenerator() {\r\n    return new AnotherExitCodeGenerator();  // implements ExitCodeGenerator\r\n}\r\n```\r\nSince @ConditionalOnMissingBean on jobExecutionExitCodeGenerator() checked for the Interface in Version 1.2.5 (the return type of the method), AnotherExitCodeGenerator just needed to implement ExitCodeGenerator in order to oversteer the definition in the BatchAutoConfiguration.\r\n\r\nHowever, with Version 1.3.0 this is no longer possible. You have to derive your own ExitCodeGenerator from JobExecutionExitCodeGenerator in order to oversteer it.\r\n\r\nI suggest either changing the return type back to ExitCodeGenerator or adapting the `@ConditionalOnMissingBean`to `@ConditionalOnMissingBean(ExitCodeGenerator.class)` ."},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/163908991","html_url":"https://github.com/spring-projects/spring-boot/issues/4752#issuecomment-163908991","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4752","id":163908991,"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":"2015-12-11T11:00:04Z","updated_at":"2015-12-11T11:00:04Z","body":"+1"}}