1 Reply Latest reply on Jul 28, 2016 8:11 AM by Haris laghari

    Rest service with validation - method being executed although validation fails

    davidlane Newbie

      Hi there,

      we have observed following behavior in the following configuration:

       

      1, Wildfly 10

      2. Rest service with @ApplicationScoped implementation class

      3. @Valid used on a DTO parameter which uses various Validators (@NotNull, @Size, etc)

      4. ExceptionMapper<ResteasyViolationException> to convert these exceptions to a response payload

       

      Everything pretty much standard.

       

      What we are observing is that when @ApplicationScoped is used that the method in question is still being executed when validation fails. If we change this to @RequestScoped then it behaves as expected.

       

      Before I go to the trouble of creating a sample project maybe this is expected behavior? I haven't found any reference to this anywhere.

       

      Regards,

      David