mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-07 17:59:02 +00:00
Use @Validated as trigger for JSR-330 validation
Update `ConfigurationPropertiesBindingPostProcessor` so that `@Validated` is expected to be used to trigger JSR-330 validation. Any existing configuration classes that use JSR-330 annotations but don't have `@Validated` will currently still be validated, but will now log a warning. This should give users a chance to add the requested annotations before the next Spring Boot release where we will use them as the exclusive signal that validation is required. Closes gh-7579
This commit is contained in:
+4
@@ -58,6 +58,10 @@ public class SampleSimpleApplicationTests {
|
||||
SampleSimpleApplication.main(new String[0]);
|
||||
String output = this.outputCapture.toString();
|
||||
assertThat(output).contains("Hello Phil");
|
||||
assertThat(output).contains("The @ConfigurationProperties bean class "
|
||||
+ "sample.simple.SampleConfigurationProperties contains "
|
||||
+ "validation constraints but had not been annotated "
|
||||
+ "with @Validated");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user