Skip to content

Commit 17d6f90

Browse files
committed
Document types to which format properties apply
Closes gh-41482
1 parent 6941d0e commit 17d6f90

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -99,17 +99,20 @@ public void setWebjarsPathPattern(String webjarsPathPattern) {
9999
public static class Format {
100100

101101
/**
102-
* Date format to use, for example 'dd/MM/yyyy'.
102+
* Date format to use, for example 'dd/MM/yyyy'. Used for formatting of
103+
* java.util.Date and java.time.LocalDate.
103104
*/
104105
private String date;
105106

106107
/**
107-
* Time format to use, for example 'HH:mm:ss'.
108+
* Time format to use, for example 'HH:mm:ss'. Used for formatting of java.time's
109+
* LocalTime and OffsetTime.
108110
*/
109111
private String time;
110112

111113
/**
112-
* Date-time format to use, for example 'yyyy-MM-dd HH:mm:ss'.
114+
* Date-time format to use, for example 'yyyy-MM-dd HH:mm:ss'. Used for formatting
115+
* of java.time's LocalDateTime, OffsetDateTime, and ZonedDateTime.
113116
*/
114117
private String dateTime;
115118

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -385,17 +385,20 @@ public void setMatchingStrategy(MatchingStrategy matchingStrategy) {
385385
public static class Format {
386386

387387
/**
388-
* Date format to use, for example 'dd/MM/yyyy'.
388+
* Date format to use, for example 'dd/MM/yyyy'. Used for formatting of
389+
* java.util.Date and java.time.LocalDate.
389390
*/
390391
private String date;
391392

392393
/**
393-
* Time format to use, for example 'HH:mm:ss'.
394+
* Time format to use, for example 'HH:mm:ss'. Used for formatting of java.time's
395+
* LocalTime and OffsetTime.
394396
*/
395397
private String time;
396398

397399
/**
398-
* Date-time format to use, for example 'yyyy-MM-dd HH:mm:ss'.
400+
* Date-time format to use, for example 'yyyy-MM-dd HH:mm:ss'. Used for formatting
401+
* of java.time's LocalDateTime, OffsetDateTime, and ZonedDateTime.
399402
*/
400403
private String dateTime;
401404

spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/reactive.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,19 @@ Conversion can also be customized using the `spring.webflux.format.*` configurat
5656
When not configured, the following defaults are used:
5757

5858
|===
59-
|Property |`DateTimeFormatter`
59+
|Property |`DateTimeFormatter` |Formats
6060

6161
|configprop:spring.webflux.format.date[]
6262
|`ofLocalizedDate(FormatStyle.SHORT)`
63+
|`java.util.Date` and `java.time.LocalDate`
6364

6465
|configprop:spring.webflux.format.time[]
6566
|`ofLocalizedTime(FormatStyle.SHORT)`
67+
|java.time's `LocalTime` and `OffsetTime`
6668

6769
|configprop:spring.webflux.format.date-time[]
6870
|`ofLocalizedDateTime(FormatStyle.SHORT)`
71+
|java.time's `LocalDateTime`, `OffsetDateTime`, and `ZonedDateTime`
6972
|===
7073

7174

spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,19 @@ Conversion can also be customized using the `spring.mvc.format.*` configuration
6565
When not configured, the following defaults are used:
6666

6767
|===
68-
|Property |`DateTimeFormatter`
68+
|Property |`DateTimeFormatter` |Formats
6969

7070
|configprop:spring.mvc.format.date[]
7171
|`ofLocalizedDate(FormatStyle.SHORT)`
72+
|`java.util.Date` and `java.time.LocalDate`
7273

7374
|configprop:spring.mvc.format.time[]
7475
|`ofLocalizedTime(FormatStyle.SHORT)`
76+
|java.time's `LocalTime` and `OffsetTime`
7577

7678
|configprop:spring.mvc.format.date-time[]
7779
|`ofLocalizedDateTime(FormatStyle.SHORT)`
80+
|java.time's `LocalDateTime`, `OffsetDateTime`, and `ZonedDateTime`
7881
|===
7982

8083

0 commit comments

Comments
 (0)