So, within a custom SPI I’m using FreeMarkerUtil to fetch a ftl file within the SPI ie. get the translated string programmatically and then send it to an API.
In this case, my ftl file looks very simple - its just one line e.g.
${msg("someKey")}
But for some reason, this breaks with the error
Caused by: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> msg [in template "my-file.ftl"]
Any chances I can fix this by “autowiring” a msg bean when doing this – or is there some other way I can programmatically get a translated string from resource files?
I see that in FreeMarkerLoginFormsProvider, the MessageFormatterMethod gets injected as “msg” but from the current implementation of FreeMarkerUtil, it looks impossible to do it manually.
Any suggestions on how I can provide the MessageFormatterMethod implementation and inject it into the template that I’m processing with FreeMarkerUtil?