銆愯浆銆?springBoot---蹇€熷垱寤洪」鐩紝鍒濊Вjackson
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了銆愯浆銆?springBoot---蹇€熷垱寤洪」鐩紝鍒濊Вjackson相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%97%a5%e6%9c%9f%e6%97%b6%e9%97%b4' title='鏃ユ湡鏃堕棿'>鏃ユ湡鏃堕棿
spring cli pattern jsonp object post hone 鍦板潃銆愯浆銆?springBoot(2)---蹇€熷垱寤洪」鐩紝鍒濊Вjackson
蹇€熷垱寤洪」鐩紝鍒濊Вjackson
涓€銆佸揩閫熷垱寤洪」鐩?/span>
springboot瀹樼綉鎻愪緵浜嗗伐鍏风被鑷姩鍒涘缓web搴旂敤锛氱綉鍧€锛?a href="http://start.spring.io/" target="_blank">http://start.spring.io/
瀹樼綉椤甸潰
1銆佸揩閫熷垱寤轰竴涓?/span>
閫夋嫨web浠h〃杩欐槸涓€涓獁eb椤圭洰
杩欐牱灏卞彲浠ュ惂椤圭洰鏀惧埌eclipse鎴栬€卛dea涓繘琛岃繍琛屼簡銆?/p>
杩欓噷闇€瑕佹敞鎰忓嚑鐐癸細
1.springboot2X锛屾墍闇€瑕乵evan鏄?.0+锛孞DK鏄?.8+
2.鍦ㄥ仛椤圭洰寮€鍙戠殑鏃跺€欙紝涓诲叆鍙pplication绫伙紙甯︽湁娉ㄨВ@SpringBootApplication锛夛紝瑕佹斁鍦ㄦ墍鏈夊寘涔嬩笂銆?/p>
浜屻€佸垵瑙ackson
jackson鏄痵pringboot鑷甫鐨刯son妗嗘灦
jackson甯哥敤鏍囩
锛?锛夋寚瀹氬瓧娈典笉杩斿洖锛?span style="color: rgba(255, 102, 0, 1)">@JsonIgnore
锛?锛夋寚瀹氭棩鏈熸牸寮忥細@JsonFormat(pattern="yyyy-MM-dd hh:mm:ss",locale="zh",timezone="GMT+8")
锛?锛夌┖瀛楁涓嶈繑鍥烇細@JsonInclude(Include.NON_NUll)
锛?锛夋寚瀹氬埆鍚嶏細@JsonProperty
涓句緥锛?/p>
user瀵硅薄
public class User { @JsonProperty("account") private int age; @JsonIgnore private String pwd; @JsonInclude(Include.NON_NULL) private String phone; @JsonFormat(pattern="yyyy-MM-dd hh:mm:ss",locale="zh",timezone="GMT+8") private Date createTime; //鎻愪緵set鍜実et鏂规硶锛宼ostring鏂规硶 }
Controller绫讳腑鏄犲皠鏂规硶
@GetMapping("/testjackson") public Object testjson(){ return new User(0, "瀵嗙爜", null, new Date()); }
鏁堟灉婕旂ず 鎺ュ彛娴嬭瘯宸ュ叿鏄?/span>postman
鎴戜滑鍙戠幇锛?/p>
1锛氭棩鏈熸椂闂存牸寮忓彉鎴愪簡鎸囧畾鏍煎紡
2锛歛ge灞炴€ф樉绀哄湪鐣岄潰鍙樻垚浜嗭細account
3锛歱wd骞舵病鏈夋樉绀?/p>
4锛氬洜涓簆hone灞炴€т负null锛屾墍浠ヤ篃娌℃湁鏄剧ず銆?/p>
github鍦板潃锛?a href="https://github.com/yudiandemingzi/springbootjackson" target="_blank">https://github.com/yudiandemingzi/springbootjackson
鎯冲お澶氾紝鍋氬お灏戯紝涓棿鐨勮惤宸氨鏄儲鎭笺€傛兂娌℃湁鐑︽伡锛岃涔堝埆鎯筹紝瑕佷箞澶氬仛銆備笂灏夈€?銆?/strong>
以上是关于銆愯浆銆?springBoot---蹇€熷垱寤洪」鐩紝鍒濊Вjackson的主要内容,如果未能解决你的问题,请参考以下文章
銆愯浆銆戙€怱alesfoece銆慉pproval Process 鍦?Apex 涓殑浣跨敤