Use milliseconds as default Instant serialization/deserialization
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5c976fc9d9
commit
23af542178
5 changed files with 21 additions and 22 deletions
|
@ -7,7 +7,11 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationConfig;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
|
||||
@Configuration
|
||||
public class FlingConfiguration {
|
||||
|
@ -18,8 +22,13 @@ public class FlingConfiguration {
|
|||
|
||||
@Bean
|
||||
public ObjectMapper objectMapper() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setSerializationInclusion(Include.NON_ABSENT);
|
||||
ObjectMapper objectMapper = new ObjectMapper()
|
||||
.setSerializationInclusion(Include.NON_ABSENT)
|
||||
.registerModule(new JavaTimeModule())
|
||||
// Handle instant as milliseconds
|
||||
.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
|
||||
.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false);
|
||||
|
||||
return objectMapper;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,11 +23,4 @@ public class ArtifactDto {
|
|||
private Instant uploadTime;
|
||||
|
||||
private FlingDto fling;
|
||||
|
||||
@JsonProperty("uploadTime")
|
||||
public Long getJsonUploadTime() {
|
||||
if(uploadTime == null) return null;
|
||||
|
||||
return uploadTime.toEpochMilli();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,9 +93,4 @@ public class FlingDto {
|
|||
|
||||
return expiration;
|
||||
}
|
||||
|
||||
@JsonProperty("creationTime")
|
||||
public Long getJsonUploadTime() {
|
||||
return creationTime.toEpochMilli();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ spring:
|
|||
username: sa
|
||||
password:
|
||||
jpa:
|
||||
open-in-view: false
|
||||
hibernate.ddl-auto: update
|
||||
database-platform: org.hibernate.dialect.H2Dialect
|
||||
servlet:
|
||||
|
|
|
@ -5,6 +5,7 @@ spring:
|
|||
username: sa
|
||||
password:
|
||||
jpa:
|
||||
open-in-view: false
|
||||
hibernate.ddl-auto: update
|
||||
database-platform: org.hibernate.dialect.H2Dialect
|
||||
servlet:
|
||||
|
|
Loading…
Reference in a new issue