I am using spring MVC and would like to expose default validator for javascript to use. I have a bunch of controllers extending a common abstract class and bunch of validators implementing a common interface. The situation is something like this:
public abstract class AbstractController {
protected Validator validator;
}
public class FooController extends AbstractController{}
public class BarController extends AbstractController{}
public interface Validator {}
public class FooValidator implementes Validator{}
public class BarValidator implementes Validator{}
I would like to automatically set the validator field for each concrete controller respectivelly (so that FooController.validator would be instance of FooValidator). The matching should be done by class names automatically.