idtitlesidebar_label
install
安装
安装

Spring Boot项目

若您的项目基于Spring Boot,那只要添加下面一个 maven 依赖便可。

  1. <dependency>
  2. <groupId>com.dtflys.forest</groupId>
  3. <artifactId>forest-spring-boot-starter</artifactId>
  4. <version>1.5.0-RC7</version>
  5. </dependency>

如果您用的是Gradle:

  1. compile group: 'com.dtflys.forest', name: 'spring-boot-starter-forest', version: '1.5.0-RC1'

Spring项目

若您的项目基于非Spring Boot的普通Spring项目,则需添加 Forest 核心包依赖和 Forest Spring 包依赖

  1. <dependency>
  2. <groupId>com.dtflys.forest</groupId>
  3. <artifactId>forest-core</artifactId>
  4. <version>1.5.0-RC7</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>com.dtflys.forest</groupId>
  8. <artifactId>forest-spring</artifactId>
  9. <version>1.5.0-RC7</version>
  10. </dependency>

如果您用的是Gradle:

  1. compile group: 'com.dtflys.forest', name: 'forest-core', version: '1.5.0-RC7'
  2. compile group: 'com.dtflys.forest', name: 'forest-spring', version: '1.5.0-RC7'

非Spring普通项目

若您的项目既非Spring Boot也非普通Spring项目,只需添加 Forest 核心包依赖

  1. <dependency>
  2. <groupId>com.dtflys.forest</groupId>
  3. <artifactId>forest-core</artifactId>
  4. <version>1.5.0-RC7</version>
  5. </dependency>

如果您用的是Gradle:

  1. compile group: 'com.dtflys.forest', name: 'forest-core', version: '1.5.0-RC7'

添加JSON框架依赖

如果您的项目中还没有JSON解析框架,如FastjsonJackson,请根据需要添加以下依赖。如果已经有了,可以跳过此步

Fastjson依赖:版本 >= 1.2.48

  1. <dependency>
  2. <groupId>com.alibaba</groupId>
  3. <artifactId>fastjson</artifactId>
  4. <version>1.2.48</version>
  5. </dependency>

Jackson依赖:版本 >= 2.9.10

  1. <dependency>
  2. <groupId>com.fasterxml.jackson.core</groupId>
  3. <artifactId>jackson-core</artifactId>
  4. <version>2.9.10</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>com.fasterxml.jackson.core</groupId>
  8. <artifactId>jackson-databind</artifactId>
  9. <version>2.9.10</version>
  10. </dependency>
  11. <dependency>
  12. <groupId>com.fasterxml.jackson.core</groupId>
  13. <artifactId>jackson-annotations</artifactId>
  14. <version>2.9.10</version>
  15. </dependency>