Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
ff15d136
Commit
ff15d136
authored
Mar 26, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-20687
parents
d8f218d8
ab01c55d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletion
+21
-1
WebMvcAutoConfiguration.java
...ot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java
+3
-1
WebMvcProperties.java
...work/boot/autoconfigure/web/servlet/WebMvcProperties.java
+13
-0
WebMvcAutoConfigurationTests.java
...toconfigure/web/servlet/WebMvcAutoConfigurationTests.java
+4
-0
spring-boot-features.adoc
...ing-boot-docs/src/docs/asciidoc/spring-boot-features.adoc
+1
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java
View file @
ff15d136
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -220,6 +220,7 @@ public class WebMvcAutoConfiguration {
}
@Override
@SuppressWarnings
(
"deprecation"
)
public
void
configurePathMatch
(
PathMatchConfigurer
configurer
)
{
configurer
.
setUseSuffixPatternMatch
(
this
.
mvcProperties
.
getPathmatch
().
isUseSuffixPattern
());
configurer
.
setUseRegisteredSuffixPatternMatch
(
...
...
@@ -227,6 +228,7 @@ public class WebMvcAutoConfiguration {
}
@Override
@SuppressWarnings
(
"deprecation"
)
public
void
configureContentNegotiation
(
ContentNegotiationConfigurer
configurer
)
{
WebMvcProperties
.
Contentnegotiation
contentnegotiation
=
this
.
mvcProperties
.
getContentnegotiation
();
configurer
.
favorPathExtension
(
contentnegotiation
.
isFavorPathExtension
());
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java
View file @
ff15d136
...
...
@@ -22,6 +22,7 @@ import java.util.Locale;
import
java.util.Map
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.DeprecatedConfigurationProperty
;
import
org.springframework.http.MediaType
;
import
org.springframework.util.Assert
;
import
org.springframework.validation.DefaultMessageCodesResolver
;
...
...
@@ -366,10 +367,14 @@ public class WebMvcProperties {
*/
private
String
parameterName
;
@DeprecatedConfigurationProperty
(
reason
=
"Use of path extensions for request mapping and for content negotiation is discouraged."
)
@Deprecated
public
boolean
isFavorPathExtension
()
{
return
this
.
favorPathExtension
;
}
@Deprecated
public
void
setFavorPathExtension
(
boolean
favorPathExtension
)
{
this
.
favorPathExtension
=
favorPathExtension
;
}
...
...
@@ -416,18 +421,26 @@ public class WebMvcProperties {
*/
private
boolean
useRegisteredSuffixPattern
=
false
;
@DeprecatedConfigurationProperty
(
reason
=
"Use of path extensions for request mapping and for content negotiation is discouraged."
)
@Deprecated
public
boolean
isUseSuffixPattern
()
{
return
this
.
useSuffixPattern
;
}
@Deprecated
public
void
setUseSuffixPattern
(
boolean
useSuffixPattern
)
{
this
.
useSuffixPattern
=
useSuffixPattern
;
}
@DeprecatedConfigurationProperty
(
reason
=
"Use of path extensions for request mapping and for content negotiation is discouraged."
)
@Deprecated
public
boolean
isUseRegisteredSuffixPattern
()
{
return
this
.
useRegisteredSuffixPattern
;
}
@Deprecated
public
void
setUseRegisteredSuffixPattern
(
boolean
useRegisteredSuffixPattern
)
{
this
.
useRegisteredSuffixPattern
=
useRegisteredSuffixPattern
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java
View file @
ff15d136
...
...
@@ -431,6 +431,7 @@ class WebMvcAutoConfigurationTests {
}
@Test
@Deprecated
void
customMediaTypes
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.mvc.contentnegotiation.media-types.yaml:text/yaml"
,
"spring.mvc.contentnegotiation.favor-path-extension:true"
).
run
((
context
)
->
{
...
...
@@ -685,6 +686,7 @@ class WebMvcAutoConfigurationTests {
}
@Test
@Deprecated
void
useSuffixPatternMatch
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.mvc.pathmatch.use-suffix-pattern:true"
,
"spring.mvc.pathmatch.use-registered-suffix-pattern:true"
).
run
((
context
)
->
{
...
...
@@ -705,6 +707,7 @@ class WebMvcAutoConfigurationTests {
}
@Test
@Deprecated
void
pathExtensionContentNegotiation
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.mvc.contentnegotiation.favor-path-extension:true"
)
.
run
((
context
)
->
{
...
...
@@ -716,6 +719,7 @@ class WebMvcAutoConfigurationTests {
}
@Test
@Deprecated
void
queryParameterContentNegotiation
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.mvc.contentnegotiation.favor-parameter:true"
).
run
((
context
)
->
{
RequestMappingHandlerMapping
handlerMapping
=
context
.
getBean
(
RequestMappingHandlerMapping
.
class
);
...
...
spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc
View file @
ff15d136
...
...
@@ -2315,6 +2315,7 @@ Instead of using suffix matching, we can use a query parameter to ensure that re
spring.mvc.contentnegotiation.media-types.markdown=text/markdown
----
Suffix pattern matching is deprecated and will be removed in a future release.
If you understand the caveats and would still like your application to use suffix pattern matching, the following configuration is required:
[source,properties,indent=0,subs="verbatim,quotes,attributes",configprops]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment