I've been looking a around for a while now with no luck. I'n not using Spring MVC but still want to use @javax.validation.Valid
to enable validation of method arguments. To give an example
public class EventServiceImpl implements IEventService {
@Override
public void invite(@Valid Event event, @Valid User user) { ... }
}
Using MVC, this is enabled for @Controller
annotated beans with a simple <mvc:annotation-driven/>
(see 5.7.4.3 Configuring a JSR-303 Validator for use by Spring MVC).
Using AOP should be quite trivial. Nevertheless, I suspect there's some standard way to do this. Hence the question: Is there a similar thing for non-MVC applications and non-controller beans to enable input validation for annotated beans?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…