是否必须将我的所有模板thymeleaf放在目录“src / main / resources / templates”中?与它们一起使用的子文件夹,不能是?,以改善组织
例如,我在控制器中有这个方法:
/**
* List all centros.
*
* @param model
* @return
*/
@RequestMapping(value = "/centros", method = RequestMethod.GET)
public String list(Model model) {
model.addAttribute("centros", centroService.listAllCentros());
System.out.println("Returning centros:");
return "centros/centros";
}
我的Centros模板位于resources / templates / centros /中 . 有没有办法配置Thymeleaf来解决这些模板?
1 回答
你可以告诉Thymeleaf在哪里寻找模板:Thymeleaf migration
或者,如果您将使用多个子文件夹,只需让您的控制器返回“/ centros / centros”,这就是您现在正在做的事情 .