ClassLoaderTemplateResolver classLoaderTemplateResolver =newClassLoaderTemplateResolver();classLoaderTemplateResolver.setOrder(Integer.valueOf(1));// This classloader will not be even asked for any templates not matching these patterns classLoaderTemplateResolver.getResolvablePatternSpec().addPattern("/layout/*.html");classLoaderTemplateResolver.getResolvablePatternSpec().addPattern("/menu/*.html");ServletContextTemplateResolver servletContextTemplateResolver =newServletContextTemplateResolver(servletContext);servletContextTemplateResolver.setOrder(Integer.valueOf(2));