Prior to this commit the MustacheViewResolver used reflection to instantiate a MustacheView class, which fails when using AOT. Creating the view without reflection (analogous to the FreemarkerViewResolver) will fix this without the need for additional constructor hints.

Fixes: #32028

Comment From: snicoll

Thanks for the PR.

Fixes: https://github.com/spring-projects/spring-boot/issues/32028

Have you tried the smoke test against your change?

Comment From: mdeinum

There was a style error which failed the validation (apparently they are slightly different then the Spring Framework ones). I ran ./gradlew check and that, locally, turned out green.

Comment From: snicoll

Sorry, that wasn't my question. You've mentioned that it fixes #32028 so I am asking if you've tested https://github.com/spring-projects/spring-aot-smoke-tests/tree/main/mustache-webmvc with that change.

Comment From: mdeinum

Tried to run it but it downloads the dependencies from the SNAPSHOT repository so it still has the old code and obviously it fails the tests. How can I run the test (it should be the mustache-webflux one) with my local artifacts?

As this commit removes the reflection and replaces it with a regular new MustacheView() (just as with FreeMarker and the servlet MustacheViewResolver) I'm pretty confident it will work. Nonetheless if there is an easy way to run the test with a local artifact I'm going to try and run it.

Comment From: snicoll

Thanks for the reply and for trying out the sample. You can run the smoke test with Gradle's --include-build and point to your checkout of Spring Boot with the change.

Comment From: mdeinum

Thanks for the hint. Just ran the tests and I have a successful build with the change.