casid / jte

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

Integration on start.spring.io #240

Open casid opened 1 year ago

casid commented 1 year ago

Quoting metalhead-001 from reddit, who asked about this in the jte 3 comments.

I really wish the Spring project would adopt this as one of the supported Spring Boot templating engines that show up on start.spring.io like Thyemeaf, Freemarker, etc. do. Have you considered attempting to get jte brought into Spring like the others?

As far as getting it integrated into start.spring.io, I think you would just have to open a pull request into the Spring project and include your starter with it...basically follow the same pattern as the Thymeleaf and Freemarker, etc. integrations.

I bet if you got that going they would be willing to accept it as they have accepted the other templating engines. There is also a bit of documentation that would have to be provided. Look at the documentation on the Thymeleaf integration here. Search for Thymeleaf on this 'one page' documentation and you can see everywhere it's documented. Similar documentation would have to be provided for jte.

https://docs.spring.io/spring-boot/docs/3.1.0/reference/htmlsingle/

@atomfrede do you think we should give this a try?

atomfrede commented 1 year ago

Why not. It seems there is some kind of proposal process, so maybe we should start with creating such a proposal. But I could imagine it is easier as jte is "just" a template engine and not backed by a company like this proposal https://github.com/spring-io/start.spring.io/issues/1114

casid commented 1 year ago

Oh yes, the proposal you linked looks frightening. I'm unsure if we are ready to commit to this.

atomfrede commented 1 year ago

Should we try to create a proposal here together? At jcon a lot of people knew and asked Thomas and me about jte vs thymeleaf for example. So I would say there is some interest

casid commented 1 year ago

That would be awesome! What would be the best way to collaborate on a document like this? Best thing I could think of would be a branch with a markdown file in it?

Also, really cool to hear that people where asking about jte 😊

tschuehly commented 1 year ago

@casid Yea I currently support 2 template engines in my library, and JTE is definitely the better option, for using with Spring ViewComponent. Thymeleaf has a lot of Spring Magic, that you don't really need with server-side components.

I just need to get going on my compile time checker because then JTE would be completely type safe and null safe, cause currently JTE throws an error at runtime if a property that is declared as an parameter is not available in the model.

btw did you see my Spring I/O Talk? I also talked a bit about JTE there: https://youtu.be/DPAtQU-erM4?t=749

casid commented 1 year ago

@tschuehly great talk, thanks for sharing the video!

As for type-safety of params, maybe the new jte-models extension could be helpful?

nicholasnet commented 3 months ago

@casid, if it’s okay with you, I would like to add support for JTE templates in Generator Genie. I’ve already started the process but ran into this issue, which I posted on StackOverflow. Once this issue is resolved, I plan to add support for JTE templates.

casid commented 3 months ago

Welcome @nicholasnet

Sure thing, go for it, that's very much appreciated!

Can you post a stacktrace of the error you run into in production?

nicholasnet commented 3 months ago

Sure here is the repo link I think that will be easier. As you see this is plain vanilla Spring Boot MVC app. https://github.com/nicholasnet/jte-spring-gradle

Here if you do just ./gradlew bootRun Then go to http://localhost:8080 it works.

However, if you do ./gradlew bootBuildImage Then run the image docker run -it --rm -p '8080:8080' -e 'SPRING_PROFILES_ACTIVE=prod' jte:0.0.1-SNAPSHOT Then go to http://localhost:8080 it does not work.

tschuehly commented 1 month ago

I've just submitted an issue for integrating it into start.spring.io: https://github.com/spring-io/start.spring.io/issues/1560

tschuehly commented 1 week ago

Hey @casid, Moritz waits for feedback from you. Would be awesome if you could approve the integration!