IDE support the creation wizard to quickly create a project using Spring Spring Boot project;
selecting module we need; networking wizard to create a Spring Boot project;
generated by default Spring Boot project;
● main program has generated good,
● Resources folder The directory structure
. static: Save all static resources; JS CSS ImagesRF Royalty Free;
. templates: Save all template pages; (Spring Boot default jar package using an embedded Tomcat, JSP pages by default do not support
surface); you can use the template engine (FreeMarker, Thymeleaf);
. application.properties: Spring Boot application configuration file; you can modify the - some of the default settings; such as port port
This is the logic of our own need to write
1 // all methods of this class to return data directly addressed to the browser, if the object can be converted to the JSON data 2 // is the Controller @, @ responseBody 3 @RestController // RestController is a function only appeared after Spring4.2 , two upstairs fit . 4 public class HelloController in { . 5 @RequestMapping ( "/ Hello" ) . 6 . 7 public String Hello () { . 8 return "Hello World Quick" ; . 9 } 10 // RESTAPI embodiment 11 }