Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement
Milestone
Description
Masatoshi Tada opened SPR-16840 and commented
public class SampleForm {
@NotBlank
private String message;
@NotNull
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate birthday;
public SampleForm(String message, @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate birthday) {
this.message = message;
this.birthday = birthday;
}
public String getMessage() {
return message;
}
public LocalDate getBirthday() {
return birthday;
}
}
If field's annotation is missing, a value in textbox become "yy/MM/dd" when returning to input view.
If constructor parameter's annotation is missing, a validation error occurs in spite of inputting correct value.
So I have to add annotations to both of field and constructor parameter.
I think this is verbose.
Affects: 5.0.6
Issue Links:
- Enable REST controller method parameter annotations on an interface [SPR-11055] #15682 Enable REST controller method parameter annotations on an interface
- No type-based error code used by immutable form class when type conversion error occurs [SPR-16854] #21394 No type-based error code used by immutable form class when type conversion error occurs
Referenced from: commits 955665b
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement
Activity
spring-projects-issues commentedon Jul 17, 2018
Juergen Hoeller commented
This will be available in the upcoming
5.1.0.BUILD-SNAPSHOT. Please give it an early try...spring-projects-issues commentedon Aug 8, 2018
Masatoshi Tada commented
I upgraded my sample to Spring 5.1.RC1, and I found this issue was fixed! Thanks!
MasatoshiTada/spring-mvc-form-sample@03357f6#diff-e8fbdaff32189592f4b1858a9f878268