Spring Boot Development Rest Interface

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.