简体   繁体   中英

Can jackson ObjectMapper convert static and final fields of the class?

for example, if I have class A

public class A {
    public static final String STR_VAL = "some value";
    public String message = "some message";

    // getters and setters...
}

if I send this class to some spring webClient like webClient.postForObject(new A());

is jackson converting all the fields? what will be the actual JSON?

Jackson won't convert static fields out-of-the-box. Your JSON result will be:

{"message":"some message"}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM