This is an automated email from the ASF dual-hosted git repository.
zhaoqingran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/master by this push:
new 9a7e0411a [fixbug]fix parameter parsing problem (#2251)
9a7e0411a is described below
commit 9a7e0411a1c1b812e2738ca2b13116831b8d91f4
Author: Jast <[email protected]>
AuthorDate: Sun Jul 14 01:10:35 2024 +0800
[fixbug]fix parameter parsing problem (#2251)
Co-authored-by: tomsun28 <[email protected]>
---
.../hertzbeat/manager/config/JacksonConfig.java | 26 +++++++++++++++-------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git
a/manager/src/main/java/org/apache/hertzbeat/manager/config/JacksonConfig.java
b/manager/src/main/java/org/apache/hertzbeat/manager/config/JacksonConfig.java
index 820f4e35c..cf437b097 100644
---
a/manager/src/main/java/org/apache/hertzbeat/manager/config/JacksonConfig.java
+++
b/manager/src/main/java/org/apache/hertzbeat/manager/config/JacksonConfig.java
@@ -22,8 +22,10 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
import lombok.extern.slf4j.Slf4j;
+import
org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
/**
* jackson config
@@ -31,15 +33,23 @@ import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class JacksonConfig {
+
@Bean
- public ObjectMapper objectMapper() {
- JavaTimeModule javaTimeModule = new JavaTimeModule();
- final SimpleDateFormat simpleDateFormat = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
- simpleDateFormat.setTimeZone(TimeZone.getDefault());
+ public Jackson2ObjectMapperBuilderCustomizer customizer() {
+ return builder -> {
+ JavaTimeModule javaTimeModule = new JavaTimeModule();
+ final SimpleDateFormat simpleDateFormat = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
+ simpleDateFormat.setTimeZone(TimeZone.getDefault());
- return new ObjectMapper()
- .registerModule(javaTimeModule)
- .setTimeZone(TimeZone.getDefault())
- .setDateFormat(simpleDateFormat);
+ builder.modules(javaTimeModule)
+ .timeZone(TimeZone.getDefault())
+ .dateFormat(simpleDateFormat);
+ };
}
+
+ @Bean
+ public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
+ return builder.build();
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]