{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/12229","repository_url":"https://api.github.com/repos/spring-projects/spring-boot","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/12229/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/12229/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/12229/events","html_url":"https://github.com/spring-projects/spring-boot/issues/12229","id":300364564,"number":12229,"title":"Bean Validation fails when Hibernate Validator not in classpath","user":{"login":"mikebell90","id":780301,"avatar_url":"https://avatars3.githubusercontent.com/u/780301?v=4","gravatar_id":"","url":"https://api.github.com/users/mikebell90","html_url":"https://github.com/mikebell90","followers_url":"https://api.github.com/users/mikebell90/followers","following_url":"https://api.github.com/users/mikebell90/following{/other_user}","gists_url":"https://api.github.com/users/mikebell90/gists{/gist_id}","starred_url":"https://api.github.com/users/mikebell90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikebell90/subscriptions","organizations_url":"https://api.github.com/users/mikebell90/orgs","repos_url":"https://api.github.com/users/mikebell90/repos","events_url":"https://api.github.com/users/mikebell90/events{/privacy}","received_events_url":"https://api.github.com/users/mikebell90/received_events","type":"User","site_admin":false},"labels":[{"id":131737420,"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/status:%20ideal-for-contribution","name":"status: ideal-for-contribution","color":"fef2c0","default":false},{"id":16916893,"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/type:%20enhancement","name":"type: enhancement","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-02-26T19:26:18Z","updated_at":"2018-03-26T10:01:30Z","closed_at":null,"author_association":"NONE","body":"Here's the issue. Up through Spring Boot 2.0.0.M7/ Spring 5.0.3 (our last stack), things worked fine.\r\n\r\nNow upgrading to Spring Boot 2.0.0.RC/Spring 5.0.4 we get this:\r\n\r\n```\r\nCaused by: javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.\r\n\tat javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:291)\r\n\tat org.springframework.boot.validation.MessageInterpolatorFactory.getObject(MessageInterpolatorFactory.java:53)\r\n\tat org.springframework.boot.context.properties.ConfigurationPropertiesJsr303Validator$Delegate.<init>(ConfigurationPropertiesJsr303Validator.java:71)\r\n\tat org.springframework.boot.context.properties.ConfigurationPropertiesJsr303Validator.<init>(ConfigurationPropertiesJsr303Validator.java:43)\r\n\tat org.springframework.boot.context.properties.ConfigurationPropertiesJsr303Validator.getIfJsr303Present(ConfigurationPropertiesJsr303Validator.java:64)\r\n\tat org.springframework.boot.context.properties.ConfigurationPropertiesBinder.<init>(ConfigurationPropertiesBinder.java:69)\r\n\tat org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.afterPropertiesSet(ConfigurationPropertiesBindingPostProcessor.java:78)\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1769)\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706)\r\n\t... 41 more\r\n```\r\n\r\nNow, in theory it's TRUE - I do have only the validation api (2.0) on the class, and no implementation. This was however DELIBERATE - sometimes I have no interest in actually enforcing the validation, but I choose to use the API for annotations to conveniently document CONTRACT.\r\n\r\nIs there a way to bypass this check? I understand the reason for it, but I think it's wrong headed forcing this."},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/376113228","html_url":"https://github.com/spring-projects/spring-boot/issues/12229#issuecomment-376113228","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/12229","id":376113228,"user":{"login":"wilkinsona","id":914682,"avatar_url":"https://avatars3.githubusercontent.com/u/914682?v=4","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":"2018-03-26T10:01:29Z","updated_at":"2018-03-26T10:01:29Z","author_association":"MEMBER","body":"@geo-m Yes, please. @philwebb made a suggestion in his [comment above](https://github.com/spring-projects/spring-boot/blob/e6eca04af258a2d4726d97d7adbff4ff0fa5a966/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBinder.java#L94). To expand on that a little bit, rather than calling `getIfJsr303Present` in the constructor of `ConfigurationPropertiesBinder`, we'd only call it in `getValidators` if the target is annotated with `@Validated`."}}
{"actor":{"display_login":"wilkinsona"}}