diff --git a/framework-docs/modules/ROOT/pages/core/aop-api/pointcuts.adoc b/framework-docs/modules/ROOT/pages/core/aop-api/pointcuts.adoc
index aa1c2726932..ec60c9dc76f 100644
--- a/framework-docs/modules/ROOT/pages/core/aop-api/pointcuts.adoc
+++ b/framework-docs/modules/ROOT/pages/core/aop-api/pointcuts.adoc
@@ -128,18 +128,7 @@ the resulting pointcut is effectively the union of the specified patterns.)
The following example shows how to use `JdkRegexpMethodPointcut`:
-[source,xml,indent=0,subs="verbatim"]
-----
-
-
-
- .*set.*
- .*absquatulate
-
-
-
-----
+include-code::./JdkRegexpConfiguration[tag=snippet,indent=0]
Spring provides a convenience class named `RegexpMethodPointcutAdvisor`, which lets us
also reference an `Advice` (remember that an `Advice` can be an interceptor, before advice,
@@ -147,21 +136,7 @@ throws advice, and others). Behind the scenes, Spring uses a `JdkRegexpMethodPoi
Using `RegexpMethodPointcutAdvisor` simplifies wiring, as the one bean encapsulates both
pointcut and advice, as the following example shows:
-[source,xml,indent=0,subs="verbatim"]
-----
-
-
-
-
-
-
- .*set.*
- .*absquatulate
-
-
-
-----
+include-code::./RegexpConfiguration[tag=snippet,indent=0]
You can use `RegexpMethodPointcutAdvisor` with any `Advice` type.
diff --git a/framework-docs/src/main/java/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.java b/framework-docs/src/main/java/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.java
new file mode 100644
index 00000000000..84eb3a7f5a8
--- /dev/null
+++ b/framework-docs/src/main/java/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2002-2024 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.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.docs.core.aopapi.aopapipointcutsregex;
+
+import org.springframework.aop.support.JdkRegexpMethodPointcut;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+// tag::snippet[]
+@Configuration
+public class JdkRegexpConfiguration {
+
+ @Bean
+ public JdkRegexpMethodPointcut settersAndAbsquatulatePointcut() {
+ JdkRegexpMethodPointcut pointcut = new JdkRegexpMethodPointcut();
+ pointcut.setPatterns(".*set.*", ".*absquatulate");
+ return pointcut;
+ }
+}
+// end::snippet[]
diff --git a/framework-docs/src/main/java/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.java b/framework-docs/src/main/java/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.java
new file mode 100644
index 00000000000..a56be401eba
--- /dev/null
+++ b/framework-docs/src/main/java/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2002-2024 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.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.docs.core.aopapi.aopapipointcutsregex;
+
+import org.aopalliance.aop.Advice;
+
+import org.springframework.aop.support.RegexpMethodPointcutAdvisor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+// tag::snippet[]
+@Configuration
+public class RegexpConfiguration {
+
+ @Bean
+ public RegexpMethodPointcutAdvisor settersAndAbsquatulateAdvisor(Advice beanNameOfAopAllianceInterceptor) {
+ RegexpMethodPointcutAdvisor advisor = new RegexpMethodPointcutAdvisor();
+ advisor.setAdvice(beanNameOfAopAllianceInterceptor);
+ advisor.setPatterns(".*set.*", ".*absquatulate");
+ return advisor;
+ }
+}
+// end::snippet[]
+
diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.kt b/framework-docs/src/main/kotlin/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.kt
new file mode 100644
index 00000000000..16a6cba610b
--- /dev/null
+++ b/framework-docs/src/main/kotlin/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2002-2024 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.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.docs.core.aopapi.aopapipointcutsregex
+
+import org.springframework.aop.support.JdkRegexpMethodPointcut
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+
+// tag::snippet[]
+@Configuration
+class JdkRegexpConfiguration {
+
+ @Bean
+ fun settersAndAbsquatulatePointcut() = JdkRegexpMethodPointcut().apply {
+ setPatterns(".*set.*", ".*absquatulate")
+ }
+}
+// end::snippet[]
diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.kt b/framework-docs/src/main/kotlin/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.kt
new file mode 100644
index 00000000000..2ae08344f64
--- /dev/null
+++ b/framework-docs/src/main/kotlin/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.kt
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2002-2024 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.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.docs.core.aopapi.aopapipointcutsregex
+
+import org.aopalliance.aop.Advice
+import org.springframework.aop.support.RegexpMethodPointcutAdvisor
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+
+// tag::snippet[]
+@Configuration
+class RegexpConfiguration {
+
+ @Bean
+ fun settersAndAbsquatulateAdvisor(beanNameOfAopAllianceInterceptor: Advice) = RegexpMethodPointcutAdvisor().apply {
+ advice = beanNameOfAopAllianceInterceptor
+ setPatterns(".*set.*", ".*absquatulate")
+ }
+}
+// end::snippet[]
diff --git a/framework-docs/src/main/resources/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.xml b/framework-docs/src/main/resources/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.xml
new file mode 100644
index 00000000000..d008155a71d
--- /dev/null
+++ b/framework-docs/src/main/resources/org/springframework/docs/core/aopapi/aopapipointcutsregex/JdkRegexpConfiguration.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+ .*set.*
+ .*absquatulate
+
+
+
+
+
+
+
diff --git a/framework-docs/src/main/resources/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.xml b/framework-docs/src/main/resources/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.xml
new file mode 100644
index 00000000000..a4fe96e5d10
--- /dev/null
+++ b/framework-docs/src/main/resources/org/springframework/docs/core/aopapi/aopapipointcutsregex/RegexpConfiguration.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+ .*set.*
+ .*absquatulate
+
+
+
+
+
+