Netbeans 6.5 имеет улучшенный импорт проекта Eclipse, который, как предполагается, синхронизирует изменения от Netbeans назад к Eclipse: http://wiki.netbeans.org/NewAndNoteWorthyNB65#section-NewAndNoteWorthyNB65-EclipseProjectImportAndSynchronization
Вот способ решения этой проблемы:
Используя конфигурацию bean-компонента валидатора
из моего вопроса выше, вы должны добавить следующий код в каждый контроллер, используя проверку.
@Autowired
private javax.validation.Validator validator;
@InitBinder
protected void initBinder(WebDataBinder binder) {
binder.setValidator((org.springframework.validation.Validator) this.validator);
}
Это грязно, но работает, потому что LocalValidatorFactoryBean
расширяет SpringValidatorAdapter
и реализует org.springframework.validation.Validator
.
If you look at the Javadocs for ConfigurableWebBindingInitializer, its property 'validator' is of type 'org.springframework.validation.Validator'. If you then look at the Javadocs for LocalValidatorFactoryBean, you'll see that it actually implements neither FactoryBean (to create an org.springframework.validation.Validator) nor does it implement org.springframework.validation.Validator itself, so the bean you're giving the 'validator' property of ConfigurableWebBindingInitializer is of the wrong type, as indicated by the error. I suspect this is a (gross?) oversight on the part of the Spring developers, and you should create an issue for this in their JIRA issue tracker at jira.springframework.org