久久久久久久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:沒有為類型 [簡單類型,類] 找到合適的構造函數(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:沒有為類型 [簡單類型,類] 找到合適的構造函數(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] 的構造函數(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 轉換為子類的 Java 對象.請幫助杰克遜將 JSON 轉換為 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.

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

                  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
                      }
                  }
                  

                  為該類定義了一個自定義構造函數(shù),使其成為默認構造函數(shù).引入虛擬構造函數(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() {
                      }
                  
                  }
                  

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

                  【網(wǎng)站聲明】本站部分內容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(liá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 上顯式轉換 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. 主站蜘蛛池模板: 丝袜天堂 | 免费亚洲成人 | 高清欧美性猛交xxxx黑人猛交 | 亚洲精品一区二区 | 午夜精品久久久久99蜜 | 亚洲日本欧美日韩高观看 | 亚洲一区二区久久久 | 性色av一区二区三区 | 波多野吉衣久久 | 欧美精品在线观看 | 国产精品日本一区二区不卡视频 | 超碰免费在线 | 欧美在线精品一区 | 一级a性色生活片久久毛片 一级特黄a大片 | 草久视频| 婷婷色婷婷 | www.久久久.com | 欧美在线视频一区二区 | av毛片在线免费观看 | 国产91在线 | 欧美 | 国产精品毛片 | 少妇黄色 | 精品不卡| 亚洲三区在线播放 | 一色桃子av一区二区 | 欧美三级在线 | 亚洲精品一区二区在线观看 | 成人一区在线观看 | 精品久 | 久久中文高清 | 精品香蕉一区二区三区 | 国产伦精品一区二区三区精品视频 | 成人免费观看男女羞羞视频 | 久久久网| 欧美日韩综合一区 | 国产精品久久久久久久久久久免费看 | 国产一区二区三区日韩 | 玩丰满女领导对白露脸hd | 精品成人免费一区二区在线播放 | 国产欧美一区二区三区久久人妖 | 亚洲精品2 |