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,19 +7,28 @@ 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 {
|
||||
@Bean
|
||||
public MessageDigest keyHashDigest() throws NoSuchAlgorithmException {
|
||||
return MessageDigest.getInstance("SHA-512");
|
||||
}
|
||||
@Bean
|
||||
public MessageDigest keyHashDigest() throws NoSuchAlgorithmException {
|
||||
return MessageDigest.getInstance("SHA-512");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ObjectMapper objectMapper() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setSerializationInclusion(Include.NON_ABSENT);
|
||||
return objectMapper;
|
||||
}
|
||||
@Bean
|
||||
public ObjectMapper objectMapper() {
|
||||
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