Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
Validation interceptor (use in business tier) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation interceptor (use in business tier)


    I would like to validate every argument sent to a service method with a org.springmodules.validation.bean.BeanValidator.

    I've not found any ValidationMethodInterceptor class in springmodules 0.9.

    Am I missing something ?

    I've found a lot of samples on the web :

    If there's no interceptor in springmodules wouldn't it be interesting to add one (appears to be a common need) ?


    N.B sample of code of interceptor (didn't tested it or even compiled it, just to illustrate the idea) :
    public class ValidationInterceptor implements MethodBeforeAdvice {
        private Validator validator = null;
        public void     before(Method method, Object[] args, Object target) {
        for (Object arg : args) {
                Errors lErrors = new BindException(lPerson, Integer.valueOf(i));
                validator.validate(arg, lErrors);
                if (lErrors.hasErrors()) {
                    throw lErrors;
            method.invoke (target, args);
        public void setValidator (BeanValidator aValidator) {
            mValidator = aValidator;