🏹 Springboot环境安装
# 依赖
对于 Springboot 项目来说, 只需要添加 forest-spring-boot-starter 依赖即可
<dependency>
    <groupId>com.dtflys.forest</groupId>
    <artifactId>forest-spring-boot-starter</artifactId>
    <version>1.5.36</version>
</dependency>
 1
2
3
4
5
2
3
4
5
compile group: 'com.dtflys.forest', name: 'forest-spring-boot-starter', version: '1.5.36'
 1
// Make sure to add code blocks to your code group
注意
若您的项目是基于 SpringBoot3 的,请参见《Springboot3环境安装》
# JSON框架依赖
Springboot 已自带 Jackson 框架依赖,如需要 Fastjson2 或 Fastjson1,请添加以下依赖。否则可以跳过此步
注意
Forest 自v1.5.36版本开始支持 Fastjson2,之前版本只支持 Fastjson 1.x 版本
Fastjson2依赖:版本 >= 2.0.46
<dependency>
  <groupId>com.alibaba.fastjson2</groupId>
  <artifactId>fastjson2</artifactId>
  <version>2.0.46</version>
</dependency>
 1
2
3
4
5
2
3
4
5
compile group: 'com.alibaba.fastjson2', name: 'fastjson2', version: '2.0.46'
 1
// Make sure to add code blocks to your code group
或Fastjson依赖:版本 >= 1.2.48
<dependency>
  <groupId>com.alibaba</groupId>
  <artifactId>fastjson</artifactId>
  <version>1.2.73</version>
</dependency>
 1
2
3
4
5
2
3
4
5
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.73'
 1
// Make sure to add code blocks to your code group
# XML框架依赖
  <dependency>
      <groupId>com.dtflys.forest</groupId>
      <artifactId>forest-jaxb</artifactId>
      <version>1.5.36</version>
  </dependency>
 1
2
3
4
5
2
3
4
5
compile group: 'com.dtflys.forest', name: 'forest-jaxb', version: '1.5.36'
 1
// Make sure to add code blocks to your code group
# Protobuf框架依赖
如果您的项目需要使用 Protobuf, 就需要引入 Google 的 Protobuf 包依赖
若是已经引入了 forest-spring-boot-starter 启动包,就不用再引入该依赖了,因为在 Forest 的启动包中已经传递依赖此包
版本 >= 3.14.0
<dependency>
  <groupId>com.google.protobuf</groupId>
  <artifactId>protobuf-java</artifactId>
  <version>3.18.1</version>
</dependency>
 1
2
3
4
5
2
3
4
5
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.18.1'
 1
// Make sure to add code blocks to your code group
帮助我们改善此文档  (opens new window)
  上次更新: 2024/12/26, 12:59:11