Spring Boot Learning (a) initial project, join the Web module, write 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 bit idea!!

Spring boot, a new framework provided by the pivotal team, is designed to simplify the initial set-up and development process of new spring applications. The framework is configured in a specific way so that developers no longer need to define a boilerplate configuration. In this way, Spring boot is committed to becoming a leader in the booming field of rapid application development (rapid application development).

Spring Boot Features

1. Create a standalone spring application

2. Inline container simplifies web projects without deploying a war file

3. Simplify MAVEN Configuration

4. Auto-Configure Spring

5. Provide production-ready functions, such as indicators, health checks and external configuration

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

Quick Start

The main goal of this chapter is to build the Spring Boot Foundation project and implement a simple HTTP request processing, which is an example of a preliminary understanding of spring boot and experience its simple, fast-developing features.

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

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/Select Build tools Maven project, Spring boot version 1.5.8, and some engineering basics, as shown in the following illustration
Click Generate Project Download item compression package

Unzip the project package and import the IDE with the MAVEN project, taking IntelliJ idea 14 as an example: select File–>new–>project from Existing Sources in the menu ... Select the Unpacked project folder, click OK click Import Project from external model and select Maven, click Next to the end. If you have multiple versions of the JDK in your environment, notice that when you choose Java SDK, please choose more than Java 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 underlying project, as shown in the figure above, the infrastructure of Spring boot consists of three files (the specific path is based on all the group variances that are filled out when the user builds the project): src/main/ Java Program entry: springboot1application src/main/resources configuration file: Application.properties src/test/ Test entrance below: springboot1applicationtests

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

Introducing Web Modules

The current pom.xml content is as follows, introducing only two modules: 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.