Skip to content

Default databinding for java 8 LocalDate  #5523

@anthony-foulfoin

Description

@anthony-foulfoin

Given an endpoint with a LocalDate parameter :

public void doSth(@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate) {
 ...
}

I must set @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) everywhere I want to bind a LocalDate. This code is boilerplate so I defined a custom editor :

webDataBinder.registerCustomEditor(LocalDate.class, new LocalDateEditor());

But it would be great if spring boot was able to do this natively with a date format in the properties file, and ISO as default.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions