我在控制器中有这样的方法
@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 我有 spring 依赖项
<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>
有什么问题?