@ NotNull @ NonNull how to use

clipboard.png

for example, how to use these two notes (do not distinguish the difference between the two for the time being)

I thought (method) added these two comments, then the return value of this method cannot be null, the editor will give the corresponding prompt that the compilation failed (like kotlin), but the result is not what I thought.
is actually exactly the same as adding or not. May I ask how to use these two annotations

?
May.06,2022

@ NotEmpty for collection classes
@ NotBlank for String
@ NotNull for basic types


Bean
@NotNull
private String name;
controller
@Valid Bean bean,BindingResult result
nameresult


Bean
public Bean(@NonNull Integer id) {
    this.id=id;
}
new Bean(null);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b42348-eb42.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b42348-eb42.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?