在以下示例中,ScriptFile参数标有@Valid注释.
是什么@Valid注解吗?
@RequestMapping(value = "/scriptfile", method = RequestMethod.POST)
public String create(@Valid ScriptFile scriptFile, BindingResult result, ModelMap modelMap) {
if (scriptFile == null) throw new IllegalArgumentException("A scriptFile is required");
if (result.hasErrors()) {
modelMap.addAttribute("scriptFile", scriptFile);
modelMap.addAttribute("showcases", ShowCase.findAllShowCases());
return "scriptfile/create";
}
scriptFile.persist();
return "redirect:/scriptfile/" + scriptFile.getId();
}
Run Code Online (Sandbox Code Playgroud) 根据这个问题,maven-gae-plugin发布了一个更新,并且需要几个小时才可以从Maven Central获得.
谁管理Maven Central以及导致这种延迟的原因是什么?
宣告TestController与Spring Controller构造型之间的区别是这样的:
import org.springframework.stereotype.Controller;
//...
@Controller
@RequestMapping("/test")
public class TestController
Run Code Online (Sandbox Code Playgroud)
与作为AbstractController的子类,如下所示:
import org.springframework.web.servlet.mvc.AbstractController;
//...
public class TestController extends AbstractController
Run Code Online (Sandbox Code Playgroud)