0
votes

We are using freemarker templates in our spring boot project for email.

There is one default directory in classpath where all base email templates are stored. And, then there are other directories for client's custom email templates.

What we want is that the template loader should first search for a given email template in the client's custom directory, and if not found, then only look into default directory.

Now, I know we can pass multiple paths in FreeMarkerConfigurationFactory setTemplateLoaderPaths(String... templateLoaderPaths). But does this method maintain the lookup order?

1

1 Answers

0
votes

FreeMarkerConfigurationFactory uses the paths to create a MultiTemplateLoader, which says:

A TemplateLoader that uses a set of other loaders to load the templates. On every request, loaders are queried in the order of their appearance in the array of loaders provided to the constructor.

So yes, the method maintains the lookup order.