Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Common comments on spring

Shulou Source: shulou.com Published: 2022-06-03 08:15:42 09月23日 Update

1. @ JsonInclude (Include.NON_NULL)

/ / place the tag on the attribute, and do not participate in serialization if the attribute is NULL

/ / if you put it on top of the class, it has an effect on all the properties of the class

/ / Include.Include.ALWAYS default

/ / Include.NON_DEFAULT attribute is default and not serialized

/ / the Include.NON_EMPTY attribute is empty ("") or NULL is not serialized.

/ / the Include.NON_NULL attribute is NULL and is not serialized

2. @ NotNull @ Length

@ NotNull (message = "user name cannot be empty")

@ Length (min=5, max=20, message= "user name length must be between 5-20")

@ Pattern (regexp = "^ [a murz Amurz ZZ]\\ w {4jue 19} $", message = "user name must begin with an alphanumeric underscore and can be composed of an alphanumeric underscore")

Private String username

Tags: Attributes sequences users user names underscores letters above between functions beginnings numbers tags length common comments Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn Shulou Tech Info macOS Microsoft