wimdeblauwe / htmx-spring-boot

Spring Boot and Thymeleaf helpers for working with htmx
Apache License 2.0
497 stars 48 forks source link

Add support for multiple ViewResolvers #41

Closed vraptorche closed 1 year ago

vraptorche commented 1 year ago

Sometimes in larger applications there is a need for multiple view resolvers. Proposed change implements support for multiple resolvers

wimdeblauwe commented 1 year ago

Can you elaborate what exact problem this solves and how this is useful?

wimdeblauwe commented 1 year ago

I am going to close this PR in a week or so if there is no further information on it.

dsyer commented 1 year ago

This is potentially of interest to me (and anyone who uses other template renderers than Thymeleaf). Actually, there is very little in this library outside the (small) thymeleaf package that is Thymeleaf specific. This would be a step in the right direction IMO. Having said that I don't think the implementation makes sense because typically there is only one important ViewResolver in an ApplicationContext (and it is a composite already so some of the logic in this PR is duplicated). I think you can locate it with a well-known bean name "viewResolver".

wimdeblauwe commented 1 year ago

If you could provide a better implementation, I am willing to add it to the library. Would be good to have some example as well of how this could be used or in what case one needs this.

dsyer commented 1 year ago

I put an implementation based on the bean name in #51. There are no samples in this project so it's hard to add an example usage. A simple use case would be to use Freemarker (for instance) or any other renderer that has a ViewResolver. I can show you what that looks like if you want, but hard to do here without some changes to the layout of the project (separate sample, separate MVC and thymeleaf libraries, for instance).

wimdeblauwe commented 1 year ago

Ok, no problem I understand better now. Thanks for the other PR. Closing this one in favor of #51