From 186e70cd0490c1141dd936aac5bace6c0f9d6dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Fri, 29 Mar 2024 18:24:50 +0100 Subject: [PATCH] Use code includes and tabs in MVC Config documentation Additional fixes. See gh-22171 --- framework-docs/framework-docs.gradle | 1 + .../webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.java | 1 + .../mvcconfig/mvcconfigpathmatching/WebConfiguration.java | 2 ++ .../webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.java | 3 +++ .../webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.kt | 1 + .../webmvc/mvcconfig/mvcconfiginterceptors/WebConfiguration.kt | 1 + .../webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.kt | 2 ++ .../webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.kt | 3 +++ 8 files changed, 14 insertions(+) diff --git a/framework-docs/framework-docs.gradle b/framework-docs/framework-docs.gradle index ce7e6c49c92..50f4dd1ea32 100644 --- a/framework-docs/framework-docs.gradle +++ b/framework-docs/framework-docs.gradle @@ -73,6 +73,7 @@ dependencies { api("com.mchange:c3p0:0.9.5.5") api("com.fasterxml.jackson.core:jackson-databind") api("com.fasterxml.jackson.module:jackson-module-parameter-names") + api("jakarta.validation:jakarta.validation-api") implementation(project(":spring-core-test")) implementation("org.assertj:assertj-core") diff --git a/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.java b/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.java index 1c388641743..f3649e9accd 100644 --- a/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.java +++ b/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.java @@ -26,6 +26,7 @@ public class MyPostProcessor implements BeanPostProcessor { public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException { // ... + return bean; } } // end::snippet[] diff --git a/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.java b/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.java index be93fe127b6..f08527787dd 100644 --- a/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.java +++ b/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.java @@ -17,7 +17,9 @@ public class WebConfiguration implements WebMvcConfigurer { } private PathPatternParser patternParser() { + PathPatternParser pathPatternParser = new PathPatternParser(); // ... + return pathPatternParser; } } // end::snippet[] diff --git a/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.java b/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.java index 8c7d0cb6379..5e8f46abc61 100644 --- a/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.java +++ b/framework-docs/src/main/java/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.java @@ -18,6 +18,7 @@ package org.springframework.docs.web.webmvc.mvcconfig.mvcconfigvalidation; import org.springframework.context.annotation.Configuration; import org.springframework.validation.Validator; +import org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; // tag::snippet[] @@ -26,7 +27,9 @@ public class WebConfiguration implements WebMvcConfigurer { @Override public Validator getValidator() { + Validator validator = new OptionalValidatorFactoryBean(); // ... + return validator; } } // end::snippet[] diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.kt b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.kt index 8c74484407f..c5628f27de4 100644 --- a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.kt +++ b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigadvancedxml/MyPostProcessor.kt @@ -25,6 +25,7 @@ class MyPostProcessor : BeanPostProcessor { override fun postProcessBeforeInitialization(bean: Any, name: String): Any { // ... + return bean } } // end::snippet[] diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfiginterceptors/WebConfiguration.kt b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfiginterceptors/WebConfiguration.kt index 076636d7773..c2f6d8daba1 100644 --- a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfiginterceptors/WebConfiguration.kt +++ b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfiginterceptors/WebConfiguration.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:Suppress("DEPRECATION") package org.springframework.docs.web.webmvc.mvcconfig.mvcconfiginterceptors import org.springframework.context.annotation.Configuration diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.kt b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.kt index 3b992374c49..1ee4be3095c 100644 --- a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.kt +++ b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigpathmatching/WebConfiguration.kt @@ -32,7 +32,9 @@ class WebConfiguration : WebMvcConfigurer { } fun patternParser(): PathPatternParser { + val pathPatternParser = PathPatternParser() //... + return pathPatternParser } } // end::snippet[] \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.kt b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.kt index c0cff102808..23f2f5d4a26 100644 --- a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.kt +++ b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/WebConfiguration.kt @@ -18,6 +18,7 @@ package org.springframework.docs.web.webmvc.mvcconfig.mvcconfigvalidation import org.springframework.context.annotation.Configuration import org.springframework.validation.Validator +import org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean import org.springframework.web.servlet.config.annotation.WebMvcConfigurer // tag::snippet[] @@ -25,7 +26,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer class WebConfiguration : WebMvcConfigurer { override fun getValidator(): Validator { + val validator = OptionalValidatorFactoryBean() // ... + return validator } } // end::snippet[]