Fastjson2

This article introduces Fastjson2 serialization

1 Introduction

FASTJSON v2 is an important upgrade of the FASTJSON project, aimed at providing a high-performance JSON library for the next decade. With the same API,

2 Usage

2.1 Add Dependency

<dependencies>
    <dependency>
        <groupId>com.alibaba.fastjson2</groupId>
        <artifactId>fastjson2</artifactId>
        <version>2.0.23</version>
    </dependency>
</dependencies>

Note: Fastjson2 serialization is only supported in Dubbo > 3.1.0. In Dubbo > 3.2.0, it will replace Hessian as the default serialization method.

2.2 Configure to Enable

# application.yml (Spring Boot)
dubbo:
 protocol:
   serialization: fastjson2

or

# dubbo.properties
dubbo.protocol.serialization=fastjson2

# or
dubbo.consumer.serialization=fastjson2

# or
dubbo.reference.com.demo.DemoService.serialization=fastjson2

or

<dubbo:protocol serialization="fastjson2" />

<!-- or -->
<dubbo:consumer serialization="fastjson2" />

<!-- or -->
<dubbo:reference interface="xxx" serialization="fastjson2" />