Skip to content

Conversation

mdeinum
Copy link
Contributor

@mdeinum mdeinum commented Aug 9, 2022

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 9, 2022
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 9, 2022
@philwebb philwebb added this to the 3.0.x milestone Aug 9, 2022
@snicoll
Copy link
Member

snicoll commented Aug 9, 2022

Thanks for the PR.

Fixes: #32028

Have you tried the smoke test against your change?

@mdeinum
Copy link
Contributor Author

mdeinum commented Aug 10, 2022

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.

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: spring-projects#32028
@snicoll
Copy link
Member

snicoll commented Aug 15, 2022

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.

@mdeinum
Copy link
Contributor Author

mdeinum commented Aug 16, 2022

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.

@snicoll
Copy link
Member

snicoll commented Aug 16, 2022

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.

@mdeinum
Copy link
Contributor Author

mdeinum commented Aug 16, 2022

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

@snicoll snicoll self-assigned this Aug 16, 2022
@snicoll snicoll modified the milestones: 3.0.x, 3.0.0-M5 Aug 17, 2022
snicoll pushed a commit that referenced this pull request Aug 17, 2022
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.

See gh-32030
@snicoll snicoll closed this in f580123 Aug 17, 2022
@mdeinum mdeinum deleted the gh-32028 branch August 17, 2022 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add native-image support for Mustache on WebFlux
4 participants