Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When setting spring.freemarker.template-loader-path to an s3 bucket, the SpringTemplateLoader is not selected [SPR-15445] #20006

spring-issuemaster opened this issue Apr 12, 2017 · 2 comments


None yet
2 participants
Copy link

commented Apr 12, 2017

Brad Giaccio opened SPR-15445 and commented

The default config uses classpath:/templates/ which eventually gets processed by FreeMarkerConfigurationFactory.getTemplateLoaderForPath

I've set

spring.freemarker.template-loader-path=s3://my-bucket/templates, classpath:/templates/

However, the code relies on an IOException but in the case of S3 the returned SimpleStorageResource.getFile() throws UnsupportedOperationException

try {
	Resource path = getResourceLoader().getResource(templateLoaderPath);
	File file = path.getFile();  // will fail if not resolvable in the file system
} catch (IOException ex) {
	return new SpringTemplateLoader(getResourceLoader(), templateLoaderPath);

So I believe the catch just need to be converted to a multicatch to handle both.

I see that if I set ```

Affects: 4.3.7


This comment has been minimized.

Copy link
Collaborator Author

commented Apr 12, 2017

Juergen Hoeller commented

We can easily catch all exceptions there since we're logging them anyway and can always try to fall back to our general template loader. This is in master now; I'll backport this to 4.3.8 tomorrow.


This comment has been minimized.

Copy link
Collaborator Author

commented Apr 12, 2017

Brad Giaccio commented

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.