replace fastjson to JSONUtil (#636)

Co-authored-by: airoger <czzx201101136>
pull/639/head
shanjianq 2 years ago committed by GitHub
parent 36239e8a4b
commit b8059899ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,12 +29,6 @@
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

@ -17,8 +17,8 @@
package cn.hippo4j.springboot.starter.adapter.springcloud.stream.rabbitmq.example;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.example.core.dto.SendMessageDTO;
import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.function.StreamBridge;
@ -64,7 +64,7 @@ public class MessageProduce {
sendResult,
keys,
System.currentTimeMillis() - startTime,
JSON.toJSONString(payload));
JSONUtil.toJSONString(payload));
}
}
}

@ -17,8 +17,8 @@
package cn.hippo4j.springboot.starter.adapter.springcloud.stream.rabbitmq.example;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.core.enable.EnableDynamicThreadPool;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.boot.SpringApplication;
@ -44,7 +44,7 @@ public class ServerAdapterSpringCloudStreamRabbitMQApplication {
MessageHeaders headers = message.getHeaders();
log.info("Input current thread name: {} ,{} received from partition {}",
Thread.currentThread().getName(),
JSON.toJSONString(message.getPayload()),
JSONUtil.toJSONString(message.getPayload()),
headers.get(AmqpHeaders.CONSUMER_QUEUE));
};
}

@ -17,8 +17,8 @@
package cn.hippo4j.springboot.starter.adapter.springcloud.stream.rocketmq.example;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.example.core.dto.SendMessageDTO;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.Headers;
@ -41,7 +41,7 @@ public class MessageConsume {
// ignore
} finally {
log.info("Keys: {}, Msg id: {}, Execute time: {} ms, Message: {}", headers.get("rocketmq_KEYS"), headers.get("rocketmq_MESSAGE_ID"), System.currentTimeMillis() - startTime,
JSON.toJSONString(message));
JSONUtil.toJSONString(message));
}
log.info("Input current thread name: {}", Thread.currentThread().getName());
}
@ -53,7 +53,7 @@ public class MessageConsume {
// ignore
} finally {
log.info("Keys: {}, Msg id: {}, Execute time: {} ms, Message: {}", headers.get("rocketmq_KEYS"), headers.get("rocketmq_MESSAGE_ID"), System.currentTimeMillis() - startTime,
JSON.toJSONString(message));
JSONUtil.toJSONString(message));
}
log.info("Input2 current thread name: {}", Thread.currentThread().getName());
}

@ -17,8 +17,8 @@
package cn.hippo4j.springboot.starter.adapter.springcloud.stream.rocketmq.example;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.example.core.dto.SendMessageDTO;
import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageConst;
@ -61,7 +61,7 @@ public class MessageProduce {
.uid(keys)
.build();
Message<?> message = MessageBuilder
.withPayload(JSON.toJSONString(payload))
.withPayload(JSONUtil.toJSONString(payload))
.setHeader(MessageConst.PROPERTY_KEYS, keys)
.setHeader(MessageConst.PROPERTY_TAGS, tags)
.build();
@ -74,7 +74,7 @@ public class MessageProduce {
sendResult,
keys,
System.currentTimeMillis() - startTime,
JSON.toJSONString(payload));
JSONUtil.toJSONString(payload));
}
}
}

Loading…
Cancel
Save