Spring Boot Starter Applet

Source: Internet
Author: User

1. First create a MAVEN project in Eclipse-javaee

GROUPID:SPRINGBOOTTEST4 (name is just an example)

Artifactid:springboottest4

Open Pom.xml File

Edit the following

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";
<modelversion>4.0.0</modelversion>
<groupid>springboottest4</groupid>
< Artifactid>springboottest4</artifactid>
<version>0.0.1-snapshot</version>
< Packaging>jar</packaging>
<name>springboottest4</name>
<url>http:// Maven.apache.org</url>
<properties>
<project.build.sourceencoding>utf-8</ Project.build.sourceencoding>
</properties>
<dependencies>
<dependency>
< Groupid>org.springframework.boot</groupid>
<artifactid>spring-boot-starter-web</ Artifactid>
<version>1.3.3.release</version>
</dependency>
</dependencies>
</project>

2. Create a new class

can refer to my:

Package com.springboottest;
/**
* @author Zzfweb
* @mail [email protected]
* Function: Demonstrate a simple example of spring boot
*/
Import org.springframework.boot.SpringApplication;
Import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
Import org.springframework.web.bind.annotation.RequestMapping;
Import Org.springframework.web.bind.annotation.RestController;

@RestController
is a controller layer annotation that handles JSON-type data
@EnableAutoConfiguration
Enable automatic configuration
public class Example {

@RequestMapping ("Index.do")
/**
* Set up the mapping, after launch, the browser input localhost:8080/index.do can be accessed
* (@RequestMapping parameters can be arbitrary, the best composite specification)
**/
String Home () {
Return "Hello Welcome to Zzfweb blog!";
Browser page Output return this sentence
}

public static void Main (string[] args) throws Exception {
Springapplication.run (Example.class, args);//Entry of the program

}
}

3, click to run, in the browser address bar input http://localhost:8080/index.do

And that's it.

=========== There is something wrong, thank you! =============

Spring Boot Starter Applet

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.