spring-guides / getting-started-guides

Getting Started Guide template :: The template for new guides and also the place to request them.
https://github.com/spring-guides/getting-started-guides/wiki
Apache License 2.0
521 stars 204 forks source link

Uploading Files Guide doesn't mention Thymeleaf dependency #28

Closed toomasr closed 8 years ago

toomasr commented 8 years ago

I went over the https://spring.io/guides/gs/uploading-files/ guide and to my surprise got a Whitelabel Error Page rather the expected output.

After googling around and seeing people having similar problems and I figured it out. I had to have Thymeleaf as a dependency. I contributed the answer at http://stackoverflow.com/questions/31134333/spring-uploadthis-application-has-no-explicit-mapping-for-error/

I think if you mention in the Guide that you need to have that dependency then less people would get the Whitelabel Error.

gregturn commented 8 years ago

Not sure I'm following the issue. Both the "initial" and the "complete" versions of code have spring-boot-starter-thmyeleaf in both maven and gradle builds. The prose also mentioned Thymeleaf. So where did things go wrong exactly?

toomasr commented 8 years ago

I generated a spring boot application. And then went through bunch of guides. The upload guide I found by googling for "spring boot file upload". I opened up the guide, added the controller, template and then got an error. Error of course has nothing to do with the upload functionality of the app or missing a dependency.

I didn't do the primary flow of opening the guide and checking out the guide project. I guess the other guy on Stackoverflow didn't either.

The name Thymeleaf is mentioned in the tutorial but when you are starting out with Spring boot you don't make the connection instantly that you are missing a dependency. Maybe something to add to the What you'll need section?

When you google for the error for the upload you actually get many results where people have turned to multiple Forums with the same problem. See https://www.google.com/search?q=spring+upload%3AThis+application+has+no+explicit+mapping+for+%2Ferror&oq=spring+upload%3AThis+application+has+no+explicit+mapping+for+%2Ferror

gregturn commented 8 years ago

The problem as mentioned on that SO question is that the Spring MVC route is at /upload, but the op is visiting /, for which there is no mapping. When you visit an undefined route, Spring Boot is configured to print out the default error page instead of giving away server specific details.

To make this less confusing, I updated the guide to operate at / instead of /upload.

There is no value in putting Thymeleaf among the things you'll need at the top of the guide, because thymeleaf is NOT something you need before you get underway with the guide. Instead, it's something pulled in by exercising the guide.

Resolved via https://github.com/spring-guides/gs-uploading-files/commit/1f329cb1665bf694418c5569fee29d2836daf2c5