In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
In this case, my field definition is xVal,yVal, using the @ Data annotation of lombok.
Then I found the following partial article, https://bbs.csdn.net/topics/392305619, in which the answer is the picture, I just translated the picture.
The following is the original quote:
Jackson2's handling of pojo type serialization.
When Jackson2 initializes the serializer, it collects the property information of the pojo type object, including member variables and methods, and then saves the property name and the processed method name to a LinkedHashMap as key. During the collection, the legacyManglePropertyName method in com.fasterxml.jackson.databind.util.BeanUtil is called to process the method name, which removes the get/set method prefix, that is, get or set, and returns the successive uppercase characters that follow it. For example: getNEWString will be converted to newstring return. If your attribute name has such a "nSmallSellCount", the get method automatically generated by lombok will be such "getNSmallSellCount", and after processing will be such "nsmallSellCount", which does not conflict with the attribute nSmallSellCount and can exist in HashMap at the same time. After collecting the attribute information, the following steps delete non-visible attributes, which generally refer to private member variables. In this case, the member variable attribute named "nSmallSellCount" will be deleted, so there will be no problem with the serialization result. However, if you add the @ JsonProperty annotation, Jackson2 will think that this attribute is visible and need not be deleted. In this case, the two attributes that represent the same worthwhile attribute will be serialized together.
After the translation, I am so tired.
Summarize the knowledge points:
1.jackson only goes to the fields of the get set method when serializing by default, and private fields do not participate in serialization.
The 2.@JsonProperty annotation is on the private property, indicating that the private field is visible when serialized, and you can specify the name of the serialization.
If 3.@JsonProperty is annotated on the get set method, there will be no problem 4. The @ Data annotation of lombok is used in the project, so it can only be annotated on attributes, which leads to problems. Br/ > 4. The @ Data annotation of lombok is used in the project, so it can only be annotated on attributes, which leads to problems.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.