Getting a list of all available Thymeleaf views from Spring application context

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting a list of all available Thymeleaf views from Spring application context

mmoayyed
Background:
Using Thymeleaf 3.0.9 in a Spring Boot 1.5.8 application. Caching is turned on.

My goal is to be able to find a way to locate all thymeleaf views (possibly in the Spring Application context) and list them somehow. I believe this requires that I configure thymeleaf to eagerly load all views and .html files on startup rather than on-demand and then somehow reach into the ThymeleafViewResolver or the template engine, etc to locate all that is resolved.

Is this sort of capability available with Thymeleaf today? and what would be the best path going forward?

Misagh

Reply | Threaded
Open this post in threaded view
|

Re: Getting a list of all available Thymeleaf views from Spring application context

yvanavermaet
Hi

I'm unsure what the use case is, but what's stopping you from doing this by checking the correct "views" folder on the file system?

Kind regards,
Yannick
Reply | Threaded
Open this post in threaded view
|

Re: Getting a list of all available Thymeleaf views from Spring application context

mmoayyed
While that may be an option, it would prove impractical as there is not a single folder and even in the case of many folders, not all views are required to be resolvable some of which may be excluded. It's doable nonetheless, but I am curious to see if there is a more Springish way of doing this.