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 org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
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
|
@Configuration
|
||||||
public class FlingConfiguration {
|
public class FlingConfiguration {
|
||||||
@Bean
|
@Bean
|
||||||
public MessageDigest keyHashDigest() throws NoSuchAlgorithmException {
|
public MessageDigest keyHashDigest() throws NoSuchAlgorithmException {
|
||||||
return MessageDigest.getInstance("SHA-512");
|
return MessageDigest.getInstance("SHA-512");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ObjectMapper objectMapper() {
|
public ObjectMapper objectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper()
|
||||||
objectMapper.setSerializationInclusion(Include.NON_ABSENT);
|
.setSerializationInclusion(Include.NON_ABSENT)
|
||||||
return objectMapper;
|
.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 Instant uploadTime;
|
||||||
|
|
||||||
private FlingDto fling;
|
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;
|
return expiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("creationTime")
|
|
||||||
public Long getJsonUploadTime() {
|
|
||||||
return creationTime.toEpochMilli();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ spring:
|
||||||
username: sa
|
username: sa
|
||||||
password:
|
password:
|
||||||
jpa:
|
jpa:
|
||||||
|
open-in-view: false
|
||||||
hibernate.ddl-auto: update
|
hibernate.ddl-auto: update
|
||||||
database-platform: org.hibernate.dialect.H2Dialect
|
database-platform: org.hibernate.dialect.H2Dialect
|
||||||
servlet:
|
servlet:
|
||||||
|
|
|
@ -5,6 +5,7 @@ spring:
|
||||||
username: sa
|
username: sa
|
||||||
password:
|
password:
|
||||||
jpa:
|
jpa:
|
||||||
|
open-in-view: false
|
||||||
hibernate.ddl-auto: update
|
hibernate.ddl-auto: update
|
||||||
database-platform: org.hibernate.dialect.H2Dialect
|
database-platform: org.hibernate.dialect.H2Dialect
|
||||||
servlet:
|
servlet:
|
||||||
|
|
Loading…
Reference in a new issue