How can i use Kotlin extension function in a Thymeleaf template ?
For example, let's take a simple case
<div th:text="${mystring.test()}">placeholder</div>
where test()
is an extension function for String
class defined in a Spring Boot kotlin file as
fun String.test(): String = this
With this code I obtain a SpelEvaluationException
org.springframework.expression.spel.SpelEvaluationException:
EL1004E: Method call: Method test() cannot be found on type java.lang.String
org.springframework.boot:spring-boot-starter-thymeleaf version is 2.1.1.RELEASE
Thank you