We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All the GraalVM Micronaut Views applications have the same structure and have a controller like:
@Controller("/views") public class ViewsController { @Get("/handlebars") public ModelAndView<User> handlebars() { return new ModelAndView<>("handlebars/home", new User("Iván", true)); } @View("/handlebars/home") @Get("/handlebars-view") public HttpResponse<User> handlebarsPojoView() { return HttpResponse.ok(new User("Iván", true)); } }
Then in the html template rendered we check if the user is logged in and render they name.
This works for all the view technologies except for Handlebars and only when returning an HttpResponse. When returning a ModelAndView it also works.
HttpResponse
ModelAndView
It works in JIT mode but it fails now as a GraalVM native image.
git clone https://github.com/micronaut-graal-tests/micronaut-views-graal
cd micronaut-views-graal
git checkout handlebars-micronaut3-error
sdk use java 21.2.0.r11-grl
./gradlew nativeImage
./build/native-image/views-handlebars
curl localhost:8080/views/handlebars-view
curl localhost:8080/views/handlebars
Both curl requests should return the same
$ curl localhost:8080/views/handlebars-view <!DOCTYPE html> <html> <head> <title>Handlebars</title> <meta charset="utf-8"> </head> <body> <h1>You are not logged in</h1> </body> </html>
$ curl localhost:8080/views/handlebars <!DOCTYPE html> <html> <head> <title>Handlebars</title> <meta charset="utf-8"> </head> <body> <h1>username: <span>Iván</span></h1> </body> </html>
The text was updated successfully, but these errors were encountered:
is User annotated with @Introspected?
User
@Introspected
Sorry, something went wrong.
Yes https://github.com/micronaut-graal-tests/micronaut-views-graal/blob/3.0.x_handlebars/src/main/java/example/micronaut/User.java#L5. Please keep in mind that the same application works for the other technologies: Thymeleaf, Freemarker,...
No branches or pull requests
All the GraalVM Micronaut Views applications have the same structure and have a controller like:
Then in the html template rendered we check if the user is logged in and render they name.
This works for all the view technologies except for Handlebars and only when returning an
HttpResponse
. When returning aModelAndView
it also works.It works in JIT mode but it fails now as a GraalVM native image.
Steps to Reproduce
git clone https://github.com/micronaut-graal-tests/micronaut-views-graal
cd micronaut-views-graal
git checkout handlebars-micronaut3-error
sdk use java 21.2.0.r11-grl
./gradlew nativeImage
./build/native-image/views-handlebars
curl localhost:8080/views/handlebars-view
curl localhost:8080/views/handlebars
Expected Behaviour
Both curl requests should return the same
Actual Behaviour
Environment Information
The text was updated successfully, but these errors were encountered: