1. Configure the <parent> and <depencencies> of the Pom.xml file;, specify the Spring boot Web dependency
<Parent> <groupId>Org.springframework.boot</groupId> <Artifactid>Spring-boot-starter-parent</Artifactid> <version>1.4.1.RELEASE</version> <RelativePath/> <!--Lookup parent from repository -</Parent><Dependencies> <Dependency> <groupId>Org.springframework.boot</groupId> <Artifactid>Spring-boot-starter-web</Artifactid> </Dependency> <Dependency> <groupId>Org.springframework.boot</groupId> <Artifactid>Spring-boot-starter-tomcat</Artifactid> </Dependency> <Dependency> <groupId>Com.wangxiaobao</groupId> <Artifactid>Wxb-common</Artifactid> <version>1.0-snapshot</version> </Dependency></Dependencies>
2.AppMain (can be arbitrarily named) class
@SpringBootApplication Public class appmain{ publicstaticvoid main (string[] args) { Springapplication.run (Appmain. class , args);} }
The 3.RestController implements simple string reverse logic.
@RestController Public class testservice{ = "/test") public String Test (string input) { return New StringBuffer (input). reverse (). ToString ();} }
4. Start Appmain,run as Java application. Test succeeded (using Post-man):
Spring Boot Development Rest Interface