views:

25

answers:

1

Very new to spring and working my way through validation.

I have examples working where I actually implement the spring Validator class, but am working on getting examples working without implementing the Validator class and instead using annotations directly on model class attributes such as @NotBlank and @Email.

My question is this. Is there anyway to make the above scenario (annotations directly on class attributes) work where you are not naming your Controllers after the models that they are implementing?

For example if I had a FormController class and one of the functions inside dealt with adding a user. Is there anyway to Autowire the validation for the User class directly to the Annotations on the the User class or am I stuck writing a UserValidator class and using that.

A: 

Have a look at Spring-Roo. I believe they do what you are asking for.

Ralph