Springboot get started one, create a new Springboot project with MyEclipse

Source: Internet
Author: User

1. Environmental information
2. Create a new MAVEN project
2.1 新建一个web项目

2.2 生成的项目结构如下

3. Configuring the Pom.xml File
 3.1 pom.xml完整信息
<?xml version= "1.0" encoding= "UTF-8"? ><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>com.qfx </groupId> <artifactId>springbootDemo01</artifactId> <version>0.0.1-snapshot</version > <packaging>war</packaging> <name>springbootDemo01</name> <description> Fill in descriptive information here </description> <!--set up the parent class, consolidating third-party common framework Dependency information (various dependency information)--<parent> <groupid>org.springframew Ork.boot</groupid> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.    4.release</version> <relativePath/> <!--lookup parent from repository to </parent> <!--set public parameters--<properties> <projecT.build.sourceencoding>utf-8</project.build.sourceencoding> <project.reporting.outputEncoding>    Utf-8</project.reporting.outputencoding> <java.version>1.8</java.version> </properties> <dependencies> <!--introduce Springboot core package, integrate SPRINGMVC Web Components--<!--implementation principle: Maven relies on inheritance, equivalent to the third party commonly used m Aven dependency information, already encapsulated in the parent project-<dependency> <groupid>org.springframework.boot</groupid&            Gt <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--introducing Springboot Test Package--&        Gt <dependency> <groupId>org.springframework.boot</groupId> <artifactid>spring- Boot-starter-test</artifactid> <scope>test</scope> </dependency> <!-- Springboot external Tomcat support for compiling JSPs-<dependency> <groupid>org.apache.tomcat.embed</groupi D> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </depend Ency> <!--to join this when fighting a war package, tell Spring-boot tomcat related Jar Pack external, do not enter--<dependency> & Lt;groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-tomcat</art ifactid> <scope>provided</scope> </dependency> </dependencies> <        build> <!--Specify the name of the war package, whichever is here, or bring the version number--<finalName>springbootDemo01</finalName>                <plugins> <plugin> <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>
3.2 修改完毕,如果你的项目名上出现一个红色的小叉号


4. Create Springboot Startup class Demoapp.java


package com.qfx.demo;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.boot.builder.SpringApplicationBuilder;import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;/** * 
5. Create a Conttoller


package com.qfx.demo.controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class UserController {    @RequestMapping("getUser")    public String getUser(){        return "张三";    }}
6. Compiling the project

7. Start Springboot, execute the main method of the DemoApp class

8. Test access: Http://

9. Final attached project complete structure

Springboot get started one, create a new Springboot project with MyEclipse

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.