Spring Boot Learning (a) initial project, joining the Web module, writing a simple restful__web

Source: Internet
Author: User
Tags http request spring initializr

Using IntelliJ idea 2017.2.5 x64 tool learning, just I learn to use a idea!!

Spring Boot is a new framework provided by the pivotal team designed to simplify the initial setup and development of new spring applications. The framework uses a specific approach to configuration, which eliminates the need for developers to define boilerplate configurations. In this way, Spring boot is committed to becoming a leader in the burgeoning field of rapid application development (rapid application development).

Spring Boot Features

1. Create a standalone spring application

2. Inline container simplifies web projects without the need to deploy war files

3. Simplify MAVEN Configuration

4. Automatically configure Spring

5. Provide production-ready features such as indicators, health checks and external configurations

6. Absolutely no code generation and no configuration required for XML

Quick Start

The main objective of this chapter is to build the Spring Boot Foundation project and implement a simple HTTP request processing, which gives a preliminary understanding of spring boot and experiences its simple structure and rapid development.

This article uses Java 1.8.0_131, Spring Boot 1.5.8 debugging.

System Requirements : Java 7 and above Spring Framework 4.1.5 and above

Generate basic project access through the Spring INITIALIZR tool: http://start.spring.io/Choose the build Tool Maven project, Spring boot version 1.5.8, and some engineering basics, as shown in the following illustration
Click Generate Project to download the item Compression pack

Unzip the project package and use the IDE to import the MAVEN project to IntelliJ idea 14: Choose File–>new–>project from Existing Sources in the menu ... Select the extracted Items folder, click OK click Import Project from external model and select Maven, click Next to end. If you have multiple versions of the JDK in your environment, please select Java SDK version 7

If the import displays only pom.xml files, see http://www.cnblogs.com/t1508001/p/6019305.html

The above steps complete the creation of the base project, as shown in the previous figure, the Spring boot infrastructure has three files (the exact path varies according to the group all the differences that the user fills in when the project is generated): src/main/ Program entry under Java: Config file under springboot1application src/main/resources: Application.properties src/test/ Test entry under: springboot1applicationtests

Both the generated springboot1application and Springboot1applicationtests classes can be run directly to start the currently created project, because the project is currently not mated to any data access or Web modules. The program ends up running after the spring has finished loading.

introducing the Web module

The current pom.xml content is as follows, with only two modules introduced: Spring-boot-starter: core modules, including automatic configuration support, logs, and Yaml spring-boot-starter-test: Test modules, including JUnit, Hamcrest, Mockito

01 <dependencies>
02 <dependency>
03 <groupId>org.springframework.boot</groupId>
04

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.