新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
SpringBoot返回json和xml的示例代碼-創(chuàng)新互聯(lián)
有些情況接口需要返回的是xml數(shù)據(jù),在springboot中并不需要每次都轉(zhuǎn)換一下數(shù)據(jù)格式,只需做一些微調(diào)整即可。
新建一個(gè)springboot項(xiàng)目,加入依賴jackson-dataformat-xml,pom文件代碼如下:
<?xml version="1.0" encoding="UTF-8"?>4.0.0 com.dalaoyang springboot_xml 0.0.1-SNAPSHOT jar springboot_xml springboot_xml org.springframework.boot spring-boot-starter-parent 1.5.9.RELEASE UTF-8 UTF-8 1.8 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-devtools runtime org.springframework.boot spring-boot-starter-test test com.fasterxml.jackson.dataformat jackson-dataformat-xml org.springframework.boot spring-boot-maven-plugin
網(wǎng)站標(biāo)題:SpringBoot返回json和xml的示例代碼-創(chuàng)新互聯(lián)
網(wǎng)頁(yè)地址:http://ef60e0e.cn/article/ceedsp.html