diff --git a/javaxval/pom.xml b/javaxval/pom.xml
index 57369c6f52..7d009f3280 100644
--- a/javaxval/pom.xml
+++ b/javaxval/pom.xml
@@ -15,7 +15,7 @@
- org.hibernate
+ org.hibernate.validator
hibernate-validator
${hibernate-validator.version}
@@ -36,10 +36,41 @@
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven.compiler.version}
+
+
+ ${maven.compiler.target}
+ true
+
+ -Averbose=true
+ -AmethodConstraintsSupported=true
+ -AdiagnosticKind=ERROR
+
+
+
+ org.hibernate.validator
+ hibernate-validator-annotation-processor
+ ${hibernate-validator.ap.version}
+
+
+
+
+
+
+
6.0.13.Final
+ 6.2.0.Final
+ 3.6.1
+ 1.8
+ 1.8
3.0.0
5.0.2.RELEASE
-
\ No newline at end of file
+
diff --git a/javaxval/src/main/java/com/baeldung/javaxval/container/validation/Customer.java b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/Customer.java
index 03811635ee..d990647721 100644
--- a/javaxval/src/main/java/com/baeldung/javaxval/container/validation/Customer.java
+++ b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/Customer.java
@@ -20,7 +20,6 @@ public class Customer {
@PositiveOrZero
private OptionalInt numberOfOrders;
- @NotBlank
private Profile profile;
public String getName() {
diff --git a/javaxval/src/main/java/com/baeldung/javaxval/hibernate/validator/ap/Message.java b/javaxval/src/main/java/com/baeldung/javaxval/hibernate/validator/ap/Message.java
new file mode 100644
index 0000000000..55d6dafad7
--- /dev/null
+++ b/javaxval/src/main/java/com/baeldung/javaxval/hibernate/validator/ap/Message.java
@@ -0,0 +1,95 @@
+package com.baeldung.javaxval.hibernate.validator.ap;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Past;
+import java.util.List;
+import java.util.Optional;
+
+public class Message {
+
+ @NotNull(message = "Content cannot be null")
+ private String content;
+
+ private boolean isDelivered;
+
+ private List<@NotBlank String> recipients;
+
+ // uncomment in order to trigger AP annotation detection
+ // The annotation @Past is disallowed for this data type.
+ // @Past
+ private String createdAt;
+
+ public String getContent() {
+ return content;
+ }
+
+ public Message(String content, boolean isDelivered, List<@NotBlank String> recipients, String createdAt) {
+ this.content = content;
+ this.isDelivered = isDelivered;
+ this.recipients = recipients;
+ this.createdAt = createdAt;
+ }
+
+ // uncomment in order to trigger AP annotation detection
+ // The annotation @Min is disallowed for the return type of this method.
+ // @Min(3)
+ public boolean broadcast() {
+ // setup a logic
+ // to send to recipients
+ return true;
+ }
+
+ // uncomment in order to trigger AP annotation detection
+ // Void methods may not be annotated with constraint annotations.
+ // @NotNull
+ public void archive() {
+ // archive the message
+ }
+
+ // uncomment in order to trigger AP annotation detection
+ // Constraint annotations must not be specified at methods, which are no valid JavaBeans getter methods.
+ // NOTE: add -AmethodConstraintsSupported=false to compiler args before
+ // @AssertTrue
+ public boolean delete() {
+ // delete the message
+ return false;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public boolean isDelivered() {
+ return isDelivered;
+ }
+
+ public void setDelivered(boolean delivered) {
+ isDelivered = delivered;
+ }
+
+ public List getRecipients() {
+ return recipients;
+ }
+
+ public void setRecipients(List recipients) {
+ this.recipients = recipients;
+ }
+
+ public void setCreatedAt(String createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public String getName() {
+ return content;
+ }
+
+ public void setName(String content) {
+ this.content = content;
+ }
+
+ public Optional<@Past String> getCreatedAt() {
+ return Optional.ofNullable(createdAt);
+ }
+
+}