@ Jsonautodetect (class)
This is the annotation acting on the class. It is mainly used to indicate that the class uses annotation, and can automatically detect getter, setter, and constructor to generate a JSON object.
@ Jsonignore (method/Field): it acts on a method or field to indicate that the method or field with this annotation is ignored when JSON is generated.
Example:
@ Entity @ cache (usage = cacheconcurrencystrategy. read_write) @ jsonautodetect/*** here mark attributes that do not generate a JSON object. Here I mark two attributes as one hibernatelazyinitializer attribute. Why do I mark this attribute? refer to the previous blog post, A Password attribute cannot be converted to a JSON object due to security reasons. After all, JSON is called at the front end. * if you want to ignore an attribute during conversion, you can add */@ jsonignoreproperties (value = {"hibernatelazyinitializer", "password"}) public class user {private long ID; private string name; private string password; private string email; private date createat; @ ID @ generatedvalue (Strategy = generationtype. identity) Public long GETID () {return ID;} public void setid (long ID) {This. id = ID;}/*** convert the output format of the date object. For the customdateserializer code, refer to the previous blog post */@ jsonserialize (using = customdateserializer. class) Public date getcreateat () {return createat;} public void setcreateat (date createat) {This. createat = createat;}/*** other getter and setter are omitted */}