java - Is obligatory put all my templates thymeleaf in directory "rc/main/resources/templates"? -


is obligatory put templates thymeleaf in directory "src/main/resources/templates"?, subfolder them, can not be?, improve organization

for example, have method in controller:

/**  * list 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"; } 

my centros templates inside resources/templates/centros/. there way configure thymeleaf resolve these templates?

you can tell thymeleaf templates: thymeleaf migration

@bean public itemplateresolver templateresolver() {     final springresourcetemplateresolver resolver = new springresourcetemplateresolver();     resolver.setapplicationcontext(applicationcontext);     resolver.setsuffix(".html");     resolver.setprefix("classpath:/templates/");     resolver.settemplatemode(templatemode.html);     resolver.setcacheable(false);     return resolver; } 

or if using multiple subfolders, have controllers return "/centros/centros", doing now.


Comments