kolorobot / spring-mvc-quickstart-archetype

The project is a Maven archetype for Spring MVC web application.
http://blog.codeleak.pl
1.05k stars 478 forks source link

Remove layout fragment in Custom Error view ? #133

Closed DBarthe closed 5 years ago

DBarthe commented 6 years ago

Hello,

I've had a problem with this project when an unexpected exception is raised somewhere during view rendering.

The custom error handler renders the error/general.html view, which makes use of fragments/layout.html, and that failed because it references isAuthenticated() :

Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#authorization.expression('!isAuthenticated()')" (template: "fragments/layout" - line 27, col 21)

It caused me much confusion because it hides the actual error occurred in the first place .

So the solution for me was to comment the inclusion of the layout header.

Please tell me if I'm wrong because I'm totally new to spring. If not I could submit the fix.

Otherwise thanks for this project :)

kolorobot commented 5 years ago

@DBarthe I confirm the issue and preapare the fix