Skip to content

Commit 968e037

Browse files
Allan-QLBrstoyanchev
authored andcommitted
Add documentation of RequestMapping about SpEL
Signed-off-by: 秦利斌 <[email protected]>
1 parent f0a9f64 commit 968e037

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

framework-docs/modules/ROOT/pages/web/webflux/controller/ann-requestmapping.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Kotlin::
237237
URI path patterns can also have embedded `${...}` placeholders that are resolved on startup
238238
by using `PropertySourcesPlaceholderConfigurer` against local, system, environment, and
239239
other property sources. You can use this, for example, to parameterize a base URL based on
240-
some external configuration.
240+
some external configuration. SpEL expression `#{...}` is also supported in URI path pattern by default.
241241

242242
NOTE: Spring WebFlux uses `PathPattern` and the `PathPatternParser` for URI path matching support.
243243
Both classes are located in `spring-web` and are expressly designed for use with HTTP URL

framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-requestmapping.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Kotlin::
220220
URI path patterns can also have embedded `${...}` placeholders that are resolved on startup
221221
by using `PropertySourcesPlaceholderConfigurer` against local, system, environment, and
222222
other property sources. You can use this, for example, to parameterize a base URL based on
223-
some external configuration.
223+
some external configuration. SpEL expression `#{...}` is also supported in URI path pattern by default.
224224

225225

226226
[[mvc-ann-requestmapping-pattern-comparison]]

spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,16 @@
109109
* At the method level, relative paths (for example, {@code "edit"}) are supported
110110
* within the primary mapping expressed at the type level.
111111
* Path mapping URIs may contain placeholders (for example, <code>"/${profile_path}"</code>).
112+
* By default, SpEL expression is also supported (for example {@code "/profile/#{@bean.property}"}).
112113
* <p><b>Supported at the type level as well as at the method level!</b>
113114
* When used at the type level, all method-level mappings inherit
114115
* this primary mapping, narrowing it for a specific handler method.
115116
* <p><strong>NOTE</strong>: A handler method that is not mapped to any path
116117
* explicitly is effectively mapped to an empty path.
117118
* @since 4.2
119+
* @see org.springframework.beans.factory.config.EmbeddedValueResolver
120+
* @see org.springframework.context.expression.StandardBeanExpressionResolver
121+
* @see org.springframework.context.support.AbstractApplicationContext
118122
*/
119123
@AliasFor("value")
120124
String[] path() default {};

0 commit comments

Comments
 (0)