0 Replies Latest reply on May 11, 2015 10:22 AM by oscarfh

    WildFly not triggering method validation automatically

    oscarfh

      I have the following structure in my project:

       

       

      public interface MyInterface {
          public String lookup(@NotNull String text);
      }
      

       

      @Stateless
      public class MyBean implements MyInterface {
           public String lookup(String text){
                return "found";
           }
      }
      

       

      public class Presenter{
          @EJB
          private MyBean myBean;
      
          public void lookup(final String term) {
               myBean.lookup(term);
          }
      }
      

       

       

      I was expecting Wildfly to call the method validation when I call lookup, causing an exception to be thrown when term is null.

      It is not happening and I have to explicitly anotate my bean with an intereceptor that performs the validation.

       

      Reading Hibernate Validator's documentation, it states that the validation will be automatically performed.

       

      What should I do to so WildFly performs the validation? Am I missing something?

       

      I dont't think it is important, but the lookup method in the Presenter is called using an observer design pattern.