Spring Boot 1: Create a Spring boot project using idea

Source: Internet
Author: User
Tags apache tomcat

The environment in which the project is used:

    • Windows 10
    • JDK8
    • IntelliJ Idea 2017.1.3
    • Apache Tomcat 8
    • Maven 3.3.3
Create a new spring boot project using idea new project

Select the spring Initializer type.

Fill in the relevant project information

Select Denpendcy

Next, select the web.

Select Path

Next, select the project path, click Finish

The file directory structure of the newly completed project is as follows:

First Spring Boot Project

The Pom.xml is as follows:

    <dependencies>        <dependency>            <groupid>org.springframework.boot</ groupid>            <artifactid>spring-boot-starter-web<groupid>org.springframework.boot  <artifactid>spring-boot-starter-test<scope>test</dependencies>   

Where Spring-boot-starter-web is a Web-enabled module, Spring-boot-starter-test is a module that supports testing.

Add a helloworldcontroller as follows:

Org.springframework.web.bind.annotation.RequestMapping;  Org.springframework.web.bind.annotation.RestController;  @RestController@RequestMapping("/"index"Hello World"}}   

@RestController means that the methods inside are output in JSON format, eliminating the need to add additional JSON configurations.

Start the program

Click SHIFT + F10 or click Run, and when the project starts successfully, visit http://localhost:8080

That means the first spring boot project started successfully.

Spring Boot 1: Create a Spring boot project using idea

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.