-
Notifications
You must be signed in to change notification settings - Fork 41.2k
JsonFormat does not affect serialisation of Date #4065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@marccollin Can you please try with 1.3.0.BUILD-SNAPSHOT? #3891 made some changes to Jackson configuration, particularly when you're also using Spring Data REST or Spring HATEOAS. |
tried, get same result. sent the setup of the application, i use only annotation. @EntityScan(basePackageClasses = { ServerApplication.class, Jsr310JpaConverters.class })
@SpringBootApplication
@EnableCaching
public class ServerApplication {
public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
} |
Thanks for trying with a snapshot |
@marccollin I can't reproduce the problem on 1.3.0.M5 or 1.3.0.BUILD-SNAPSHOT. I've tried with both a plain If you'd like me to investigate further, please provide a sample project that reproduces the issue. |
it use mysql. so create a database named chezlise. all the schema will be created. if no data is created automatically only do |
This doesn't have anything to do with Spring Boot. You're returning a public static void main(String[] args) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
System.out.println(objectMapper.writeValueAsString(new Foo(new java.util.Date())));
System.out.println(objectMapper.writeValueAsString(new Foo(new java.sql.Date(System.currentTimeMillis()))));
}
static class Foo {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy", timezone="EST")
private Date birthdate;
public Foo() {
}
public Foo(Date birthdate) {
this.birthdate = birthdate;
}
public Date getBirthdate() {
return birthdate;
}
} It produces the following output:
Note that the Jackson documentation has this to say about
|
if i use @TeMPOraL(javax.persistence.TemporalType.TIMESTAMP) that work. |
i use spring boot 1.3.0 (tried to 1.3.0.M5), spring-data-jpa, spring rest and mysql.
i use java 8.
In my dto i have
client still continue to receive yyyy-mm-dd
The text was updated successfully, but these errors were encountered: