@NotNull annotation not working as expected Java Jersey

后端 未结 2 1899
旧时难觅i
旧时难觅i 2021-01-03 00:41

I have an endpoint implementation, that I am passing an object to in the parameter list. I am trying to verify that this object is not null, using the @NotNull annotation. <

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 01:19

    If you have bean-validation dependency on classpath (org.glassfish.jersey.ext:jersey-bean-validation:2.22.2) it should be picked up by the framework and work out of the box.

    Also make sure that your @NotNull annotation comes from javax.validation.constraints package

提交回复
热议问题