我在控制器中有这样的方法
@ModelAttribute("registerForm")
public RegisterForm getRegisterForm() {
return new RegisterForm();
}
@RequestMapping("/registration.html")
@ResponseBody
public String registration(
@ModelAttribute("registerForm") @Valid RegisterForm form,
BindingResult result) {
validator.validate(form, result);
if (result.hasErrors()) {
logger.debug("ERRORS WAS FOUND");
} else {
logger.debug("NO ERRORS!");
}
return null;
}
但当我mvn package
时,我遇到了编译错误 - cannot find symbol
在pom.xml中,我有春天的家属
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
和javax.validation
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
问题是什么?