casid / jte

Secure and speedy templates for Java and Kotlin.
https://jte.gg
Apache License 2.0
737 stars 54 forks source link

Question: Dynamicially Compiled Tempates on Application Servers #314

Closed pwlan closed 6 months ago

pwlan commented 6 months ago

Hi,

I am just enjoying trying out the jte framework and have a question. When running the Template Engine on a server, i get the following error message

For self contained applications jte templates must be precompiled. See https://jte.gg/pre-compiling/#using-the-application-class-loader for more information.

I kinda understand where/why this is coming from.

But i just wanted to ask, if there is anyway to use Dynamicially Compiled Tempates on the server when using a uber-jar, in this case, spring boot?

The idea is that we would like to load the templates from a db, for example, allowing us to update the templates without a redeployment of the server.

edward3h commented 6 months ago

Loading templates from a DB has been discussed before. JTE templates can contain arbitrary Java code which will be executed in your server process, so it's not a good idea. Imagine putting java source files in your database and having the server compile and run them.

edward3h commented 6 months ago

Could you explain why you want to avoid redeploying the server?

pwlan commented 6 months ago

Hi,

thanks for the reply! Yes, i thought that would be the reason.

We are just evaluting different workflows at the moment. We are also looking at keeping templates in k8 ConfigMaps or even a CMS.

But i understand the concern. My question has been answered, thanks!