Replace hardwired ViewResolver beans with autowiring
Basics
Logistics
Basics
Logistics
Description
To accomodate future support for alternative view technologies like Thymeleaf, we’d like to be able to allow plugins to add in their own view resolvers.
This will require a factory bean to build the list of resolvers to plug into Spring WebFlow in the mvcViewFactoryCreator bean (via auto-wiring, conceivably).
Initially the Services API seemed like a solution but I’m not sure we need it, because we already support plugin-contributed Spring files added before/after the mvc-beans.xml file (which is in a subordinate Spring context around the MVC servlet, not the global one).
If we have a way to auto-wire the resolvers into SWF, that might be enough to plug in new view resolvers that will also work for MVC alone.
Down the road we can move Velocity out to its own plugin too, but for now we just need the mechanics working to let a Thymeleaf plugin work.
Environment
None
Activity
Scott Cantor February 5, 2024 at 4:13 PM
Once I remembered to add the context-scanning declaration, this was simple. Logging indicates it is sorting the resolvers as expected.
Unless we hit ordering issues, anything in an MVC post-config resource adding new ViewResolvers should get them into the system dynamically.
Scott Cantor February 5, 2024 at 2:20 PM
No, this all depends on auto-wiring because MVC grabs all of the extant ViewResolver beans itself but SWF uses an explicit list of them. I have to address that mismatch with the same trick I used to auto-wire all the IdP’s descriptor objects which had the same problem.
Rod Widdowson February 3, 2024 at 1:47 PM
If we have a way to auto-wire the resolvers into SWF, that might be enough to plug in new view resolvers that will also work for MVC alone.
Presumably this would involve something like the getBeans method that takes a class parameter?
To accomodate future support for alternative view technologies like Thymeleaf, we’d like to be able to allow plugins to add in their own view resolvers.
This will require a factory bean to build the list of resolvers to plug into Spring WebFlow in the
mvcViewFactoryCreator
bean (via auto-wiring, conceivably).Initially the Services API seemed like a solution but I’m not sure we need it, because we already support plugin-contributed Spring files added before/after the mvc-beans.xml file (which is in a subordinate Spring context around the MVC servlet, not the global one).
If we have a way to auto-wire the resolvers into SWF, that might be enough to plug in new view resolvers that will also work for MVC alone.
Down the road we can move Velocity out to its own plugin too, but for now we just need the mechanics working to let a Thymeleaf plugin work.