[Solved] Circular view path [index]: would dispatch back to the current handler URL [] again. Che

Error report content
circular view path [index]: would dispatch back to the current handler URL// login/index] again. Check your viewresolver setup( Hint: This may be the result of an unspecified view, due to default view name generation.)

Change @ controller to @ restcontroller

The @restcontroller annotation is equivalent to the function of @ResponseBody + @ controller
without annotation, @ResponseBody or @restcontroller will set the return value to JSON format, otherwise it will automatically think that you are returning a page
in the @ controller annotation, you can return a string or a template name that matches the string, that is, directly render the view and use it with HTML pages,

In this case, the front-end and back-end requirements are relatively high. The Java back-end code should be rendered in combination with HTML. The data of the model object (or modelandview) will be used to fill in the relevant attributes in the user view, and then displayed to the browser. This process can also be called rendering

In @restcontroller, you should return an object, that is, return a user object. At this time, you can also see that the return is a JSON string corresponding to a user object without a page. The function of the front end is to use the returned JSON to parse and render the page, and the code of the Java back end is relatively free.

Read More: