Skip to content

Commit 9a45692

Browse files
committed
Remove - from path-match and content-negotiation properties
Closes gh-11913
1 parent 83f65a3 commit 9a45692

File tree

6 files changed

+37
-37
lines changed

6 files changed

+37
-37
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,21 @@ public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
218218
@Override
219219
public void configurePathMatch(PathMatchConfigurer configurer) {
220220
configurer.setUseSuffixPatternMatch(
221-
this.mvcProperties.getPathMatch().isUseSuffixPattern());
221+
this.mvcProperties.getPathmatch().isUseSuffixPattern());
222222
configurer.setUseRegisteredSuffixPatternMatch(
223-
this.mvcProperties.getPathMatch().isUseRegisteredSuffixPattern());
223+
this.mvcProperties.getPathmatch().isUseRegisteredSuffixPattern());
224224
}
225225

226226
@Override
227227
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
228-
WebMvcProperties.ContentNegotiation contentNegotiation = this.mvcProperties
229-
.getContentNegotiation();
230-
configurer.favorPathExtension(contentNegotiation.isFavorPathExtension());
231-
configurer.favorParameter(contentNegotiation.isFavorParameter());
232-
if (contentNegotiation.getParameterName() != null) {
233-
configurer.parameterName(contentNegotiation.getParameterName());
234-
}
235-
Map<String, MediaType> mediaTypes = this.mvcProperties.getContentNegotiation()
228+
WebMvcProperties.Contentnegotiation contentnegotiation = this.mvcProperties
229+
.getContentnegotiation();
230+
configurer.favorPathExtension(contentnegotiation.isFavorPathExtension());
231+
configurer.favorParameter(contentnegotiation.isFavorParameter());
232+
if (contentnegotiation.getParameterName() != null) {
233+
configurer.parameterName(contentnegotiation.getParameterName());
234+
}
235+
Map<String, MediaType> mediaTypes = this.mvcProperties.getContentnegotiation()
236236
.getMediaTypes();
237237
for (Entry<String, MediaType> mediaType : mediaTypes.entrySet()) {
238238
configurer.mediaType(mediaType.getKey(), mediaType.getValue());

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ public class WebMvcProperties {
9898

9999
private final View view = new View();
100100

101-
private final ContentNegotiation contentNegotiation = new ContentNegotiation();
101+
private final Contentnegotiation contentnegotiation = new Contentnegotiation();
102102

103-
private final PathMatch pathMatch = new PathMatch();
103+
private final Pathmatch pathmatch = new Pathmatch();
104104

105105
public DefaultMessageCodesResolver.Format getMessageCodesResolverFormat() {
106106
return this.messageCodesResolverFormat;
@@ -196,12 +196,12 @@ public View getView() {
196196
return this.view;
197197
}
198198

199-
public ContentNegotiation getContentNegotiation() {
200-
return this.contentNegotiation;
199+
public Contentnegotiation getContentnegotiation() {
200+
return this.contentnegotiation;
201201
}
202202

203-
public PathMatch getPathMatch() {
204-
return this.pathMatch;
203+
public Pathmatch getPathmatch() {
204+
return this.pathmatch;
205205
}
206206

207207
public static class Async {
@@ -270,7 +270,7 @@ public void setSuffix(String suffix) {
270270

271271
}
272272

273-
public static class ContentNegotiation {
273+
public static class Contentnegotiation {
274274

275275
/**
276276
* Whether the path extension in the URL path should be used to determine the
@@ -330,7 +330,7 @@ public void setParameterName(String parameterName) {
330330

331331
}
332332

333-
public static class PathMatch {
333+
public static class Pathmatch {
334334

335335
/**
336336
* Whether to use suffix pattern match (".*") when matching patterns to requests.

spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@
414414
"type" : "java.util.Map<java.lang.String,org.springframework.http.MediaType>",
415415
"description" : "Maps file extensions to media types for content negotiation, e.g. yml to text/yaml.",
416416
"deprecation" : {
417-
"replacement" : "spring.mvc.content-negotiation.media-types",
417+
"replacement" : "spring.mvc.contentnegotiation.media-types",
418418
"level" : "error"
419419
}
420420
},

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,8 @@ public void customAsyncRequestTimeout() {
473473
public void customMediaTypes() {
474474
this.contextRunner
475475
.withPropertyValues(
476-
"spring.mvc.content-negotiation.media-types.yaml:text/yaml",
477-
"spring.mvc.content-negotiation.favor-path-extension:true")
476+
"spring.mvc.contentnegotiation.media-types.yaml:text/yaml",
477+
"spring.mvc.contentnegotiation.favor-path-extension:true")
478478
.run((context) -> {
479479
RequestMappingHandlerAdapter adapter = context
480480
.getBean(RequestMappingHandlerAdapter.class);
@@ -755,8 +755,8 @@ public void defaultPathMatching() {
755755
@Test
756756
public void useSuffixPatternMatch() {
757757
this.contextRunner
758-
.withPropertyValues("spring.mvc.path-match.use-suffix-pattern:true",
759-
"spring.mvc.path-match.use-registered-suffix-pattern:true")
758+
.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true",
759+
"spring.mvc.pathmatch.use-registered-suffix-pattern:true")
760760
.run((context) -> {
761761
RequestMappingHandlerMapping handlerMapping = context
762762
.getBean(RequestMappingHandlerMapping.class);
@@ -782,7 +782,7 @@ public void defaultContentNegotiation() {
782782
public void pathExtensionContentNegotiation() {
783783
this.contextRunner
784784
.withPropertyValues(
785-
"spring.mvc.content-negotiation.favor-path-extension:true")
785+
"spring.mvc.contentnegotiation.favor-path-extension:true")
786786
.run((context) -> {
787787
RequestMappingHandlerMapping handlerMapping = context
788788
.getBean(RequestMappingHandlerMapping.class);
@@ -797,7 +797,7 @@ public void pathExtensionContentNegotiation() {
797797
@Test
798798
public void queryParameterContentNegotiation() {
799799
this.contextRunner
800-
.withPropertyValues("spring.mvc.content-negotiation.favor-parameter:true")
800+
.withPropertyValues("spring.mvc.contentnegotiation.favor-parameter:true")
801801
.run((context) -> {
802802
RequestMappingHandlerMapping handlerMapping = context
803803
.getBean(RequestMappingHandlerMapping.class);

spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

+6-6
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,10 @@ content into your application. Rather, pick only the properties that you need.
396396
397397
# SPRING MVC ({sc-spring-boot-autoconfigure}/web/servlet/WebMvcProperties.{sc-ext}[WebMvcProperties])
398398
spring.mvc.async.request-timeout= # Amount of time before asynchronous request handling times out.
399-
spring.mvc.content-negotiation.favor-parameter=false # Whether a request parameter ("format" by default) should be used to determine the requested media type.
400-
spring.mvc.content-negotiation.favor-path-extension=false # Whether the path extension in the URL path should be used to determine the requested media type.
401-
spring.mvc.content-negotiation.media-types.*= # Maps file extensions to media types for content negotiation.
402-
spring.mvc.content-negotiation.parameter-name= # Query parameter name to use when "favor-parameter" is enabled.
399+
spring.mvc.contentnegotiation.favor-parameter=false # Whether a request parameter ("format" by default) should be used to determine the requested media type.
400+
spring.mvc.contentnegotiation.favor-path-extension=false # Whether the path extension in the URL path should be used to determine the requested media type.
401+
spring.mvc.contentnegotiation.media-types.*= # Maps file extensions to media types for content negotiation.
402+
spring.mvc.contentnegotiation.parameter-name= # Query parameter name to use when "favor-parameter" is enabled.
403403
spring.mvc.date-format= # Date format to use. For instance, `dd/MM/yyyy`.
404404
spring.mvc.dispatch-trace-request=false # Whether to dispatch TRACE requests to the FrameworkServlet doService method.
405405
spring.mvc.dispatch-options-request=true # Whether to dispatch OPTIONS requests to the FrameworkServlet doService method.
@@ -410,8 +410,8 @@ content into your application. Rather, pick only the properties that you need.
410410
spring.mvc.locale-resolver=accept-header # Define how the locale should be resolved.
411411
spring.mvc.log-resolved-exception=false # Whether to enable warn logging of exceptions resolved by a "HandlerExceptionResolver".
412412
spring.mvc.message-codes-resolver-format= # Formatting strategy for message codes. For instance, `PREFIX_ERROR_CODE`.
413-
spring.mvc.path-match.use-registered-suffix-pattern=false # Whether suffix pattern matching should work only against extensions registered with "spring.mvc.content-negotiation.media-types.*".
414-
spring.mvc.path-match.use-suffix-pattern=false # Whether to use suffix pattern match (".*") when matching patterns to requests.
413+
spring.mvc.pathmatch.use-registered-suffix-pattern=false # Whether suffix pattern matching should work only against extensions registered with "spring.mvc.contentnegotiation.media-types.*".
414+
spring.mvc.pathmatch.use-suffix-pattern=false # Whether to use suffix pattern match (".*") when matching patterns to requests.
415415
spring.mvc.servlet.load-on-startup=-1 # Load on startup priority of the Spring Web Services servlet.
416416
spring.mvc.static-path-pattern=/** # Path pattern used for static resources.
417417
spring.mvc.throw-exception-if-no-handler-found=false # Whether a "NoHandlerFoundException" should be thrown if no Handler was found to process a request.

spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

+6-6
Original file line numberDiff line numberDiff line change
@@ -2076,27 +2076,27 @@ will be mapped to `@GetMapping("/projects/spring-boot")`:
20762076

20772077
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
20782078
----
2079-
spring.mvc.content-negotiation.favor-parameter=true
2079+
spring.mvc.contentnegotiation.favor-parameter=true
20802080
20812081
# We can change the parameter name, which is "format" by default:
2082-
# spring.mvc.content-negotiation.parameter-name=myparam
2082+
# spring.mvc.contentnegotiation.parameter-name=myparam
20832083
20842084
# We can also register additional file extensions/media types with:
2085-
spring.mvc.content-negotiation.media-types.markdown=text/markdown
2085+
spring.mvc.contentnegotiation.media-types.markdown=text/markdown
20862086
----
20872087

20882088
If you understand the caveats and would still like your application to use
20892089
suffix pattern matching, the following configuration is required:
20902090

20912091
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
20922092
----
2093-
spring.mvc.content-negotiation.favor-path-extension=true
2093+
spring.mvc.contentnegotiation.favor-path-extension=true
20942094
20952095
# You can also restrict that feature to known extensions only
2096-
# spring.mvc.path-match.use-registered-suffix-pattern=true
2096+
# spring.mvc.pathmatch.use-registered-suffix-pattern=true
20972097
20982098
# We can also register additional file extensions/media types with:
2099-
# spring.mvc.content-negotiation.media-types.adoc=text/asciidoc
2099+
# spring.mvc.contentnegotiation.media-types.adoc=text/asciidoc
21002100
----
21012101

21022102

0 commit comments

Comments
 (0)