🏹 原生Java环境安装
# 依赖
若您的项目既非Spring Boot
也非Spring
的普通原生Java项目,只需添加 Forest 核心包依赖
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-core</artifactId>
<version>1.5.28</version>
</dependency>
1
2
3
4
5
2
3
4
5
compile group: 'com.dtflys.forest', name: 'forest-core', version: '1.5.28'
1
// Make sure to add code blocks to your code group
# JSON框架依赖
如果您的项目中还没有JSON解析框架,如Fastjson
或Jackson
,请根据需要添加以下依赖。如果已经有了,可以跳过此步
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
Jackson依赖:版本 >= 2.9.10
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.10</version>
</dependency>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.10'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.10'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.10'
1
2
3
2
3
// 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
# 插件安装
如果您使用的是 Intellij IDEA,可以安装 Forest 的插件 ForestX 以提高开发体验
帮助我们改善此文档 (opens new window)
上次更新: 2023/06/19, 17:37:19