Inject the ValidatorFactory instead of Validator.
This prevents the Spring Validator Factory from being injected (it does not support the 1.1 methods)
This commit is contained in:
@@ -40,6 +40,7 @@ import org.springframework.shell.standard.ShellOption;
|
||||
|
||||
import javax.validation.MessageInterpolator;
|
||||
import javax.validation.Validation;
|
||||
import javax.validation.ValidatorFactory;
|
||||
import javax.validation.metadata.ConstraintDescriptor;
|
||||
|
||||
/**
|
||||
@@ -72,7 +73,6 @@ public class Help {
|
||||
|
||||
private CommandRegistry commandRegistry;
|
||||
|
||||
@Autowired(required = false)
|
||||
private MessageInterpolator messageInterpolator = Validation.buildDefaultValidatorFactory()
|
||||
.getMessageInterpolator();
|
||||
|
||||
@@ -86,6 +86,13 @@ public class Help {
|
||||
this.commandRegistry = commandRegistry;
|
||||
}
|
||||
|
||||
|
||||
@Autowired(required = false)
|
||||
public void setValidatorFactory(ValidatorFactory validatorFactory) {
|
||||
this.messageInterpolator = validatorFactory.getMessageInterpolator();
|
||||
}
|
||||
|
||||
|
||||
@ShellMethod(value = "Display help about available commands.", prefix = "-")
|
||||
public CharSequence help(
|
||||
@ShellOption(defaultValue = ShellOption.NULL, valueProvider = CommandValueProvider.class, value = { "-C",
|
||||
|
||||
Reference in New Issue
Block a user