You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This generally works and when foobar is an instance of FooBar the td is shown.
But when I start the application with Dev Tools enabled, and I change something after reloading, the td is no longer shown.
After I suspected that class loading may be the issue, I added the following code:
After each change and reload, this shows that the ClassLoader of the foobar instance is a new RestartClassLoader but the ClassLoader of the T(some.pkg.FooBar) stays the initial one and therefore the instanceof returns false.
I don't know if it's possible, but it would be nice if the class within the Thymeleaf SpEL would be loaded by the same ClassLoader instance that loads the rest of the web application, as this would not alter the application "logic" in that case.
The README contains a screenshot of the index page after the initial start and a second one after adding just a blank line to the Application.java file and letting the DevTools reload happen.
mvitz
changed the title
ThymeleafEvaluationContext survices Spring Boot DevTools restart
ThymeleafEvaluationContext survives Spring Boot DevTools restart
Oct 21, 2024
In one of our Thymeleaf templates we have the following code:
This generally works and when
foobar
is an instance ofFooBar
thetd
is shown.But when I start the application with Dev Tools enabled, and I change something after reloading, the
td
is no longer shown.After I suspected that class loading may be the issue, I added the following code:
After each change and reload, this shows that the ClassLoader of the
foobar
instance is a newRestartClassLoader
but the ClassLoader of theT(some.pkg.FooBar)
stays the initial one and therefore theinstanceof
returnsfalse
.I don't know if it's possible, but it would be nice if the class within the Thymeleaf SpEL would be loaded by the same ClassLoader instance that loads the rest of the web application, as this would not alter the application "logic" in that case.
A simple reproducer can be found at https://github.com/mvitz/devtools-thymeleaf-classloader
The README contains a screenshot of the index page after the initial start and a second one after adding just a blank line to the Application.java file and letting the DevTools reload happen.
This was originally reported to Spring Boot at spring-projects/spring-boot#42690 and Phil Webb pointed me here.
The text was updated successfully, but these errors were encountered: