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-projects-issues opened this issue Apr 12, 2017 · 2 comments
in: web type: bug


Copy link

@spring-projects-issues spring-projects-issues 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

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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.

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 12, 2017

Brad Giaccio commented

Thank you

@spring-projects-issues spring-projects-issues added type: bug in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3.8 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: web type: bug
None yet

No branches or pull requests

2 participants