久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='LkzQ4'><style id='LkzQ4'><dir id='LkzQ4'><q id='LkzQ4'></q></dir></style></legend>
  • <i id='LkzQ4'><tr id='LkzQ4'><dt id='LkzQ4'><q id='LkzQ4'><span id='LkzQ4'><b id='LkzQ4'><form id='LkzQ4'><ins id='LkzQ4'></ins><ul id='LkzQ4'></ul><sub id='LkzQ4'></sub></form><legend id='LkzQ4'></legend><bdo id='LkzQ4'><pre id='LkzQ4'><center id='LkzQ4'></center></pre></bdo></b><th id='LkzQ4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LkzQ4'><tfoot id='LkzQ4'></tfoot><dl id='LkzQ4'><fieldset id='LkzQ4'></fieldset></dl></div>

      1. <tfoot id='LkzQ4'></tfoot>
        • <bdo id='LkzQ4'></bdo><ul id='LkzQ4'></ul>

        <small id='LkzQ4'></small><noframes id='LkzQ4'>

        JsonMappingException:沒有為類型 [簡單類型,類] 找到

        JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object(JsonMappingException:沒有為類型 [簡單類型,類] 找到合適的構(gòu)造函數(shù):無法從 JSON 對象實例化) -

        1. <legend id='k7Qzg'><style id='k7Qzg'><dir id='k7Qzg'><q id='k7Qzg'></q></dir></style></legend>

          <small id='k7Qzg'></small><noframes id='k7Qzg'>

              <tbody id='k7Qzg'></tbody>
            • <tfoot id='k7Qzg'></tfoot>

              <i id='k7Qzg'><tr id='k7Qzg'><dt id='k7Qzg'><q id='k7Qzg'><span id='k7Qzg'><b id='k7Qzg'><form id='k7Qzg'><ins id='k7Qzg'></ins><ul id='k7Qzg'></ul><sub id='k7Qzg'></sub></form><legend id='k7Qzg'></legend><bdo id='k7Qzg'><pre id='k7Qzg'><center id='k7Qzg'></center></pre></bdo></b><th id='k7Qzg'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='k7Qzg'><tfoot id='k7Qzg'></tfoot><dl id='k7Qzg'><fieldset id='k7Qzg'></fieldset></dl></div>
              • <bdo id='k7Qzg'></bdo><ul id='k7Qzg'></ul>

                  本文介紹了JsonMappingException:沒有為類型 [簡單類型,類] 找到合適的構(gòu)造函數(shù):無法從 JSON 對象實例化的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在嘗試獲取 JSON 請求并對其進行處理時收到以下錯誤:

                  I am getting the following error when trying to get a JSON request and process it:

                  org.codehaus.jackson.map.JsonMappingException:沒有找到適合類型 [simple type, class com.myweb.ApplesDO] 的構(gòu)造函數(shù):無法從 JSON 對象實例化(需要添加/啟用類型信息?)

                  org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class com.myweb.ApplesDO]: can not instantiate from JSON object (need to add/enable type information?)

                  這是我要發(fā)送的 JSON:

                  Here is the JSON I am trying to send:

                  {
                    "applesDO" : [
                      {
                        "apple" : "Green Apple"
                      },
                      {
                        "apple" : "Red Apple"
                      }
                    ]
                  }
                  

                  在Controller中,我有以下方法簽名:

                  In Controller, I have the following method signature:

                  @RequestMapping("showApples.do")
                  public String getApples(@RequestBody final AllApplesDO applesRequest){
                      // Method Code
                  }
                  

                  AllApplesDO 是 ApplesDO 的包裝器:

                  AllApplesDO is a wrapper of ApplesDO :

                  public class AllApplesDO {
                  
                      private List<ApplesDO> applesDO;
                  
                      public List<ApplesDO> getApplesDO() {
                          return applesDO;
                      }
                  
                      public void setApplesDO(List<ApplesDO> applesDO) {
                          this.applesDO = applesDO;
                      }
                  }
                  

                  ApplesDO:

                  public class ApplesDO {
                  
                      private String apple;
                  
                      public String getApple() {
                          return apple;
                      }
                  
                      public void setApple(String appl) {
                          this.apple = apple;
                      }
                  
                      public ApplesDO(CustomType custom){
                          //constructor Code
                      }
                  }
                  

                  我認為 Jackson 無法將 JSON 轉(zhuǎn)換為子類的 Java 對象.請幫助杰克遜將 JSON 轉(zhuǎn)換為 Java 對象的配置參數(shù).我正在使用 Spring 框架.

                  I think that Jackson is unable to convert JSON into Java objects for subclasses. Please help with the configuration parameters for Jackson to convert JSON into Java Objects. I am using Spring Framework.

                  在上述示例類中包含導(dǎo)致此問題的主要錯誤 - 請查看已接受的解決方案答案.

                  Included the major bug that is causing this problem in the above sample class - Please look accepted answer for solution.

                  推薦答案

                  所以,我終于意識到問題所在了.這不是我懷疑的杰克遜配置問題.

                  So, finally I realized what the problem is. It is not a Jackson configuration issue as I doubted.

                  其實問題出在ApplesDO類:

                  public class ApplesDO {
                  
                      private String apple;
                  
                      public String getApple() {
                          return apple;
                      }
                  
                      public void setApple(String apple) {
                          this.apple = apple;
                      }
                  
                      public ApplesDO(CustomType custom) {
                          //constructor Code
                      }
                  }
                  

                  為該類定義了一個自定義構(gòu)造函數(shù),使其成為默認構(gòu)造函數(shù).引入虛擬構(gòu)造函數(shù)使錯誤消失:

                  There was a custom constructor defined for the class making it the default constructor. Introducing a dummy constructor has made the error to go away:

                  public class ApplesDO {
                  
                      private String apple;
                  
                      public String getApple() {
                          return apple;
                      }
                  
                      public void setApple(String apple) {
                          this.apple = apple;
                      }
                  
                      public ApplesDO(CustomType custom) {
                          //constructor Code
                      }
                  
                      //Introducing the dummy constructor
                      public ApplesDO() {
                      }
                  
                  }
                  

                  這篇關(guān)于JsonMappingException:沒有為類型 [簡單類型,類] 找到合適的構(gòu)造函數(shù):無法從 JSON 對象實例化的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                  Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                  What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數(shù)的三元表達式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲出現(xiàn)的每個字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 char 原語?)
                    <tbody id='YiXsi'></tbody>

                  • <legend id='YiXsi'><style id='YiXsi'><dir id='YiXsi'><q id='YiXsi'></q></dir></style></legend>

                    <small id='YiXsi'></small><noframes id='YiXsi'>

                    <tfoot id='YiXsi'></tfoot>
                    • <bdo id='YiXsi'></bdo><ul id='YiXsi'></ul>
                      <i id='YiXsi'><tr id='YiXsi'><dt id='YiXsi'><q id='YiXsi'><span id='YiXsi'><b id='YiXsi'><form id='YiXsi'><ins id='YiXsi'></ins><ul id='YiXsi'></ul><sub id='YiXsi'></sub></form><legend id='YiXsi'></legend><bdo id='YiXsi'><pre id='YiXsi'><center id='YiXsi'></center></pre></bdo></b><th id='YiXsi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YiXsi'><tfoot id='YiXsi'></tfoot><dl id='YiXsi'><fieldset id='YiXsi'></fieldset></dl></div>

                          1. 主站蜘蛛池模板: 国产高清在线精品 | 久久久国产精品一区 | 精品日韩一区二区 | 美女天堂 | 久久久久久亚洲国产精品 | 亚洲天堂中文字幕 | 欧美一区二区三区一在线观看 | 欧美在线日韩 | 欧美久久久久久久久中文字幕 | 日韩成人在线视频 | 亚洲欧美激情网 | 国产精品久久一区二区三区 | 国产1区2区在线观看 | 久久精品99国产精品 | 亚洲毛片| 一区二区在线免费播放 | 99tv| 欧美精品一区二区三区一线天视频 | 中文字幕高清免费日韩视频在线 | 99国产精品视频免费观看一公开 | 狠狠婷婷综合久久久久久妖精 | 国产精品不卡视频 | 日本三级全黄三级三级三级口周 | 亚洲成人精品视频 | 天天看天天干 | 91一区二区 | 中文字幕国产 | 日韩有码一区二区三区 | 狠狠久久综合 | 欧美日韩精品影院 | 九九九视频在线观看 | 国产精品永久久久久 | 99精品国产一区二区三区 | 国产成人在线视频免费观看 | 久久国产精品一区二区三区 | 一区二区三区av夏目彩春 | 久久久久久久国产 | 人人射人人草 | 日韩国产欧美一区 | 国产不卡在线观看 | 欧美一区二 |