java - How to return a html page from a restful controller in spring boot? -


i want return simple html page controller, name of file not content. why?

this controller code:

@restcontroller public class homecontroller {      @requestmapping("/")     public string welcome() {         return "login";     } } 

this project structure:

[enter image description here

when using @restcontroller this:

@restcontroller public class homecontroller {      @requestmapping("/")     public string welcome() {         return "login";     } } 

this same in normal controller:

@controller public class homecontroller {      @requestmapping("/")     @responsebody     public string welcome() {         return "login";     } } 

using @responsebody returns return "login"; string object. object return attached payload in http body json.

this why getting login in response.


Comments