jackson介紹java
java代碼中實現序列化和反序列化的工具類git
jackson使用Demogithub
https://github.com/Naylor55/JavaDebrisCode/tree/branch_Java-Serializable/javaserializableweb
Ideal控制檯報錯信息spring
2019-05-22 15:43:20.333 [main] ERROR org.springframework.boot.SpringApplication.reportFailure:837 - Application run failed java.lang.AbstractMethodError: com.fasterxml.jackson.core.type.ResolvedType.getReferencedType()Lcom/fasterxml/jackson/core/type/ResolvedType; at com.fasterxml.jackson.core.type.ResolvedType.isReferenceType(ResolvedType.java:59) at com.fasterxml.jackson.datatype.jdk8.Jdk8TypeModifier.modifyType(Jdk8TypeModifier.java:20) at com.fasterxml.jackson.databind.type.TypeFactory._constructType(TypeFactory.java:413) at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:354) at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.getJavaType(AbstractJackson2HttpMessageConverter.java:323) at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canRead(AbstractJackson2HttpMessageConverter.java:158) at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canRead(AbstractJackson2HttpMessageConverter.java:150) at org.springframework.web.client.RestTemplate$AcceptHeaderRequestCallback.doWithRequest(RestTemplate.java:805) Disconnected from the target VM, address: '127.0.0.1:57769', transport: 'socket' at org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:868) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:685) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:644) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:564) at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:218) at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:96) at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94) at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:628) at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:364) at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) at com.leading.WarehouseserviceApplication.main(WarehouseserviceApplication.java:50)
報錯緣由json
Spring-Boot框架自身默認就引用了jackson,若是你在本身的開發項目中再次引用,就會有衝突。然而,JVM 不會告訴你是引用有衝突,而是直接給你一個類型有問題的提示。意思就是我只能告訴你類型有問題,具體的你本身查吧。IDEAL 做爲一個開發工具,在這點上面也沒有作出點貢獻。Java這個生態缺陷仍是很大的!!!bootstrap
spriing-boot 默認引用app
本身項目的pom中找到:org.springframework.boot , 並點擊進去。框架
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.6.RELEASE</version> <relativePath /> </parent>
而後再找:spriing-boot-dependencies ,並點擊進去socket
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.0.6.RELEASE</version> <relativePath>../../spring-boot-dependencies</relativePath> </parent>
而後就能夠看到spring-boot 對jackson 的引用,以下圖
解決辦法
在當前開發項目的pom文件中刪除對jackson的依賴,即刪除以下圖所示