-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
I’m trying to render dynamic templates stored in a database using JTE in a Kotlin project. I’m using a setup similar to the examples in issue #451 and issue #170
I can successfully load and compile templates on-demand, but when a template references a Kotlin DTO or data class (e.g., DonationEmail), I get a ClassNotFoundException or similar errors. It seems the compiled template cannot find the class from my project when running in a self-contained jar.
Steps to reproduce:
- Store a template in the database referencing a Kotlin DTO, e.g.:
@param com.example.demo.dto.DonationEmailDto donation
<p>Hello ${donation.name}</p>
- Load the template dynamically using DatabaseCodeResolver or a similar setup.
- Render it with a DTO instance:
templateEngine.render(templateName, DonationEmail("John"), output)
- Observe the class not found error.
Expected behavior:
The dynamic template should render correctly using the provided Kotlin DTO without errors.
Environment:
- JTE version: 3.2.1
- Kotlin version: 2.2.20
- JDK: 21
- Running as: self-contained fat jar / Spring Boot application
Question:
Is there a recommended way to make dynamic templates compiled at runtime recognize Kotlin DTO classes when running from a self-contained jar?
Metadata
Metadata
Assignees
Labels
No labels