Create spring-boot-validation module
This commit is contained in:
committed by
Phillip Webb
parent
aa11d6d0fb
commit
fc3ae4f975
@@ -84,6 +84,7 @@ include "spring-boot-project:spring-boot-tools:spring-boot-test-support"
|
||||
include "spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"
|
||||
include "spring-boot-project:spring-boot-tx"
|
||||
include "spring-boot-project:spring-boot-undertow"
|
||||
include "spring-boot-project:spring-boot-validation"
|
||||
include "spring-boot-system-tests:spring-boot-deployment-tests"
|
||||
include "spring-boot-system-tests:spring-boot-image-tests"
|
||||
include "spring-boot-tests:spring-boot-integration-tests:spring-boot-configuration-processor-tests"
|
||||
|
||||
@@ -29,6 +29,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
optional(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
optional(project(":spring-boot-project:spring-boot-undertow"))
|
||||
optional(project(":spring-boot-project:spring-boot-validation"))
|
||||
optional("ch.qos.logback:logback-classic")
|
||||
optional("org.apache.cassandra:java-driver-core") {
|
||||
exclude group: "org.slf4j", module: "jcl-over-slf4j"
|
||||
|
||||
@@ -31,6 +31,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
optional(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
optional(project(":spring-boot-project:spring-boot-undertow"))
|
||||
optional(project(":spring-boot-project:spring-boot-validation"))
|
||||
optional("org.apache.cassandra:java-driver-core") {
|
||||
exclude group: "org.slf4j", module: "jcl-over-slf4j"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,10 +31,10 @@ import org.springframework.boot.actuate.endpoint.annotation.DiscoveredEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.runner.ContextConsumer;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,10 +39,10 @@ import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
import org.springframework.boot.actuate.endpoint.web.EndpointServlet;
|
||||
import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.runner.ContextConsumer;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -51,6 +51,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
optional(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
optional(project(":spring-boot-project:spring-boot-tx"))
|
||||
optional(project(":spring-boot-project:spring-boot-validation"))
|
||||
optional("co.elastic.clients:elasticsearch-java")
|
||||
optional("com.fasterxml.jackson.core:jackson-databind")
|
||||
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
|
||||
import org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -39,7 +38,8 @@ import org.springframework.data.couchbase.repository.CouchbaseRepository;
|
||||
* @author Stephane Nicoll
|
||||
* @since 1.4.0
|
||||
*/
|
||||
@AutoConfiguration(after = { CouchbaseAutoConfiguration.class, ValidationAutoConfiguration.class })
|
||||
@AutoConfiguration(after = CouchbaseAutoConfiguration.class,
|
||||
afterName = "org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration")
|
||||
@ConditionalOnClass({ Bucket.class, CouchbaseRepository.class })
|
||||
@EnableConfigurationProperties(CouchbaseDataProperties.class)
|
||||
@Import({ CouchbaseDataConfiguration.class, CouchbaseClientFactoryConfiguration.class,
|
||||
|
||||
@@ -36,8 +36,6 @@ import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProviders;
|
||||
import org.springframework.boot.autoconfigure.thread.Threading;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidatorAdapter;
|
||||
import org.springframework.boot.autoconfigure.web.ConditionalOnEnabledResourceChain;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.autoconfigure.web.WebProperties;
|
||||
@@ -48,6 +46,7 @@ import org.springframework.boot.autoconfigure.web.format.WebConversionService;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxProperties.Format;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.convert.ApplicationConversionService;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidatorAdapter;
|
||||
import org.springframework.boot.web.codec.CodecCustomizer;
|
||||
import org.springframework.boot.web.reactive.filter.OrderedHiddenHttpMethodFilter;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -106,8 +105,10 @@ import org.springframework.web.server.session.WebSessionManager;
|
||||
* @author Weix Sun
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = { CodecsAutoConfiguration.class, ReactiveMultipartAutoConfiguration.class,
|
||||
ValidationAutoConfiguration.class, WebSessionIdResolverAutoConfiguration.class })
|
||||
@AutoConfiguration(
|
||||
after = { CodecsAutoConfiguration.class, ReactiveMultipartAutoConfiguration.class,
|
||||
WebSessionIdResolverAutoConfiguration.class },
|
||||
afterName = "org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration")
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
|
||||
@ConditionalOnClass(WebFluxConfigurer.class)
|
||||
@ConditionalOnMissingBean({ WebFluxConfigurationSupport.class })
|
||||
|
||||
@@ -43,8 +43,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProviders;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidatorAdapter;
|
||||
import org.springframework.boot.autoconfigure.web.ConditionalOnEnabledResourceChain;
|
||||
import org.springframework.boot.autoconfigure.web.WebProperties;
|
||||
import org.springframework.boot.autoconfigure.web.WebProperties.Resources;
|
||||
@@ -55,6 +53,7 @@ import org.springframework.boot.autoconfigure.web.format.WebConversionService;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties.Format;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.convert.ApplicationConversionService;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidatorAdapter;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedFormContentFilter;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedHiddenHttpMethodFilter;
|
||||
@@ -137,8 +136,8 @@ import org.springframework.web.util.UrlPathHelper;
|
||||
* @author Scott Frederick
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = { DispatcherServletAutoConfiguration.class, TaskExecutionAutoConfiguration.class,
|
||||
ValidationAutoConfiguration.class })
|
||||
@AutoConfiguration(after = { DispatcherServletAutoConfiguration.class, TaskExecutionAutoConfiguration.class },
|
||||
afterName = "org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration")
|
||||
@ConditionalOnWebApplication(type = Type.SERVLET)
|
||||
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class, WebMvcConfigurer.class })
|
||||
@ConditionalOnMissingBean(WebMvcConfigurationSupport.class)
|
||||
@@ -516,7 +515,9 @@ public class WebMvcAutoConfiguration {
|
||||
@Bean
|
||||
@Override
|
||||
public Validator mvcValidator() {
|
||||
if (!ClassUtils.isPresent("jakarta.validation.Validator", getClass().getClassLoader())) {
|
||||
if (!ClassUtils.isPresent("jakarta.validation.Validator", getClass().getClassLoader())
|
||||
|| !ClassUtils.isPresent("org.springframework.boot.validation.autoconfigure.ValidatorAdapter",
|
||||
getClass().getClassLoader())) {
|
||||
return super.mvcValidator();
|
||||
}
|
||||
return ValidatorAdapter.get(getApplicationContext(), getValidator());
|
||||
|
||||
@@ -2091,12 +2091,6 @@
|
||||
"name": "spring.thymeleaf.suffix",
|
||||
"defaultValue": ".html"
|
||||
},
|
||||
{
|
||||
"name": "spring.validation.method.adapt-constraint-violations",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to adapt ConstraintViolations to MethodValidationResult.",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "spring.webflux.hiddenmethod.filter.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
|
||||
@@ -4,8 +4,7 @@ org.springframework.boot.autoconfigure.integration.IntegrationPropertiesEnvironm
|
||||
|
||||
# Background Preinitializers
|
||||
org.springframework.boot.autoconfigure.preinitialize.BackgroundPreinitializer=\
|
||||
org.springframework.boot.autoconfigure.http.MessageConverterBackgroundPreinitializer,\
|
||||
org.springframework.boot.autoconfigure.validation.JakartaValidationBackgroundPreinitializer
|
||||
org.springframework.boot.autoconfigure.http.MessageConverterBackgroundPreinitializer
|
||||
|
||||
# Failure Analyzers
|
||||
org.springframework.boot.diagnostics.FailureAnalyzer=\
|
||||
|
||||
@@ -103,7 +103,6 @@ org.springframework.boot.autoconfigure.security.oauth2.server.servlet.OAuth2Auth
|
||||
org.springframework.boot.autoconfigure.sendgrid.SendGridAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.session.SessionAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,8 +25,8 @@ import org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfigurati
|
||||
import org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties;
|
||||
import org.springframework.boot.autoconfigure.data.couchbase.city.City;
|
||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,8 +25,8 @@ import org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfigurati
|
||||
import org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties;
|
||||
import org.springframework.boot.autoconfigure.data.couchbase.city.City;
|
||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@@ -48,8 +48,6 @@ import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.aop.AopAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidatorAdapter;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration.WebFluxConfig;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfigurationTests.OrderedControllerAdviceBeansConfiguration.HighestOrderedControllerAdvice;
|
||||
@@ -58,6 +56,8 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.runner.ContextConsumer;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.classpath.resources.WithResource;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidatorAdapter;
|
||||
import org.springframework.boot.web.codec.CodecCustomizer;
|
||||
import org.springframework.boot.web.reactive.context.ReactiveWebApplicationContext;
|
||||
import org.springframework.boot.web.reactive.filter.OrderedHiddenHttpMethodFilter;
|
||||
|
||||
@@ -49,8 +49,6 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidatorAdapter;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfigurationTests.OrderedControllerAdviceBeansConfiguration.HighestOrderedControllerAdvice;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfigurationTests.OrderedControllerAdviceBeansConfiguration.LowestOrderedControllerAdvice;
|
||||
@@ -59,6 +57,8 @@ import org.springframework.boot.test.context.runner.ContextConsumer;
|
||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.classpath.resources.WithResource;
|
||||
import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidatorAdapter;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor;
|
||||
import org.springframework.boot.web.server.servlet.MockServletWebServerFactory;
|
||||
import org.springframework.boot.web.server.servlet.ServletWebServerFactory;
|
||||
|
||||
@@ -2059,7 +2059,8 @@ bom {
|
||||
"spring-boot-testcontainers",
|
||||
"spring-boot-tomcat",
|
||||
"spring-boot-tx",
|
||||
"spring-boot-undertow"
|
||||
"spring-boot-undertow",
|
||||
"spring-boot-validation"
|
||||
]
|
||||
plugins = [
|
||||
"spring-boot-maven-plugin"
|
||||
|
||||
@@ -78,6 +78,7 @@ dependencies {
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-tomcat", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-tx", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-undertow", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-validation", configuration: "autoConfigurationMetadata"))
|
||||
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-activemq", configuration: "configurationPropertiesMetadata"))
|
||||
|
||||
@@ -6,6 +6,5 @@ description = "Starter for using Java Bean Validation with Hibernate Validator"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter"))
|
||||
api("org.apache.tomcat.embed:tomcat-embed-el")
|
||||
api("org.hibernate.validator:hibernate-validator")
|
||||
api(project(":spring-boot-project:spring-boot-validation"))
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-jsonb"))
|
||||
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
optional(project(":spring-boot-project:spring-boot-tx"))
|
||||
optional(project(":spring-boot-project:spring-boot-validation"))
|
||||
optional("jakarta.json.bind:jakarta.json.bind-api")
|
||||
optional("jakarta.persistence:jakarta.persistence-api")
|
||||
optional("jakarta.servlet:jakarta.servlet-api")
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
* @since 2.7.0
|
||||
* @see GraphQlTest
|
||||
* @see org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
* @see org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
|
||||
* @see org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
|
||||
* @see org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# AutoConfigureGraphQl auto-configuration imports
|
||||
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
|
||||
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration
|
||||
|
||||
@@ -4,6 +4,6 @@ org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
|
||||
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration
|
||||
@@ -8,7 +8,7 @@ org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfigurati
|
||||
org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
|
||||
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,9 +25,9 @@ import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration
|
||||
import org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration;
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
22
spring-boot-project/spring-boot-validation/build.gradle
Normal file
22
spring-boot-project/spring-boot-validation/build.gradle
Normal file
@@ -0,0 +1,22 @@
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "org.springframework.boot.auto-configuration"
|
||||
id "org.springframework.boot.configuration-properties"
|
||||
id "org.springframework.boot.deployed"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
}
|
||||
|
||||
description = "Spring Boot Validation"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot"))
|
||||
api("org.apache.tomcat.embed:tomcat-embed-el")
|
||||
api("org.hibernate.validator:hibernate-validator")
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import jakarta.validation.Configuration;
|
||||
import jakarta.validation.Validation;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import jakarta.validation.Validator;
|
||||
import jakarta.validation.executable.ExecutableValidator;
|
||||
@@ -45,7 +45,7 @@ import org.springframework.validation.beanvalidation.MethodValidationPostProcess
|
||||
* @author Stephane Nicoll
|
||||
* @author Madhura Bhave
|
||||
* @author Yanming Zhou
|
||||
* @since 1.5.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass(ExecutableValidator.class)
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import jakarta.validation.Configuration;
|
||||
|
||||
@@ -22,7 +22,7 @@ import jakarta.validation.Configuration;
|
||||
* Callback interface that can be used to customize {@link Configuration}.
|
||||
*
|
||||
* @author Dang Zhicairang
|
||||
* @since 3.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ValidationConfigurationCustomizer {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import jakarta.validation.ValidationException;
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.validation.beanvalidation.SpringValidatorAdapter;
|
||||
* @author Stephane Nicoll
|
||||
* @author Phillip Webb
|
||||
* @author Zisis Pavloudis
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class ValidatorAdapter implements SmartValidator, ApplicationContextAware, InitializingBean, DisposableBean {
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
/**
|
||||
* Auto-configuration for (JSR-303) Validation.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"groups": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "spring.validation.method.adapt-constraint-violations",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to adapt ConstraintViolations to MethodValidationResult.",
|
||||
"defaultValue": false
|
||||
}
|
||||
],
|
||||
"hints": []
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# Background Preinitializers
|
||||
org.springframework.boot.autoconfigure.preinitialize.BackgroundPreinitializer=\
|
||||
org.springframework.boot.validation.autoconfigure.JakartaValidationBackgroundPreinitializer
|
||||
@@ -0,0 +1 @@
|
||||
org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -32,9 +32,9 @@ import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfigurationTests.CustomValidatorConfiguration.TestBeanPostProcessor;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfigurationTests.CustomValidatorConfiguration.TestBeanPostProcessor;
|
||||
import org.springframework.boot.validation.beanvalidation.MethodValidationExcludeFilter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import jakarta.validation.Validator;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import jakarta.validation.Validator;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.validation;
|
||||
package org.springframework.boot.validation.autoconfigure;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
Reference in New Issue
Block a user