接着来说这个JSON循环引用的问题:
关于JSON格式的转化,其实关键就是这几个依赖:
1 <!-- json --> 2 3 <!-- 1号 --> 4 <dependency> 5 <groupId>com.fasterxml.jackson.core</groupId> 6 <artifactId>jackson-core</artifactId> 7 <version>2.8.1</version> 8 </dependency> 9 <!-- 2号 --> 10 <dependency> 11 <groupId>com.fasterxml.jackson.core</groupId> 12 <artifactId>jackson-annotations</artifactId> 13 <version>2.8.1</version> 14 </dependency> 15 16 <!-- 3号 --> 17 <dependency> 18 <groupId>com.fasterxml.jackson.core</groupId> 19 <artifactId>jackson-databind</artifactId> 20 <version>2.8.1</version> 21 <exclusions> 22 <exclusion> 23 <artifactId>jackson-core</artifactId> 24 <groupId>com.fasterxml.jackson.core</groupId> 25 </exclusion> 26 <exclusion> 27 <artifactId>jackson-annotations</artifactId> 28 <groupId>com.fasterxml.jackson.core</groupId> 29 </exclusion> 30 </exclusions> 31 </dependency> 32 33 <!-- 4号 --> 34 <dependency> 35 <groupId>com.google.code.gson</groupId> 36 <artifactId>gson</artifactId> 37 <version>2.7</version> 38 </dependency> 39 <!-- 5号 --> 40 <dependency> 41 <groupId>net.sf.json-lib</groupId> 42 <artifactId>json-lib</artifactId> 43 <version>2.4</version> 44 <classifier>jdk15</classifier> 45 </dependency> 46 <!-- 5号json-lib还需要以下依赖包 --> 47 <dependency> 48 <groupId>commons-lang</groupId> 49 <artifactId>commons-lang</artifactId> 50 <version>2.5</version> 51 </dependency> 52 <dependency> 53 <groupId>commons-beanutils</groupId> 54 <artifactId>commons-beanutils</artifactId> 55 <version>1.9.2</version> 56 </dependency> 57 <dependency> 58 <groupId>commons-collections</groupId> 59 <artifactId>commons-collections</artifactId> 60 <version>3.2.1</version> 61 </dependency> 62 <dependency> 63 <groupId>commons-logging</groupId> 64 <artifactId>commons-logging</artifactId> 65 <version>1.2</version> 66 </dependency>