Why are there no default settings for spring.mvc.format.* properties?

I mean: spring is convention over configuration, but when I send a POST request and want spring to parse values like 2021-07-19 into a java.time.LocalDate or java.time.LocalDateTime field, I have to explicit op-in?

Please consider setting them to some reasonable values, like:

#yyyy-MM-dd
spring.mvc.format.date=iso
spring.mvc.format.time=HH:mm:ss
spring.webflux.format.date=...

Comment From: wilkinsona

There are defaults but they're not expressed in the metadata at the moment. When the properties aren't configured, your app will use the fallbacks provided by Framework's DateTimeFormatterRegistrar:

private DateTimeFormatter getFallbackFormatter(Type type) {
    switch (type) {
        case DATE: return DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT);
        case TIME: return DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT);
        default: return DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT);
    }
}

Changing the defaults would be a breaking change which we generally try to avoid. It may be possible for us to improve the metadata though.

Comment From: membersound

Okay, while I feel FormatStyle.SHORT is a rather bad default for date, at least it could be added to the metadata and docs for clarification? Would be nice!