Springboot Quick Start

Source: Internet
Author: User

  recently learned a bit of springboot, in fact, is not a new feature, but can quickly launch a spring application, just like Maven integrates all the jar package, Springboot integrates a large department of the framework, need to use, Just introduce it in the Pom.xml file .

We used springmvc+mybtais+spring to build a Web application that required a lot of configuration files, and when the project was developed, it needed to be published to Tomcat or other containers before it could be run.

Overall, Springboot has several advantages: (1) provides various default configurations to simplify project configuration (2) inline Container Simplification Web project (Tomcat,jetty) (3) no complex XML configuration

  One: Quick Start

  (1) http://start.spring.io/, click Generate Project to generate the MAVEN project

  

  (2) To import the MAVEN project, the directory is as follows: (because my local JDK is 1.7.0, I need to change the Pom.xml file and the compiled JDK version, the default build uses jdk1.8.0)

  

  

  

  (3) New Hellocontroller, code as follows:

  

  (4) Pom.xml introduced Spring-boot-starter-web, as follows:

<?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>springboot</groupId> <artifactId>springboot</artifactId> & Lt;version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>springboot</ Name> <description>demo Project for Spring boot</description> <parent> <groupId>org.springframework.boot</groupId> &        Lt;artifactid>spring-boot-starter-parent</artifactid> <version>1.4.0.RELEASE</version> <relativePath/> <!--lookup parent from repository to </parent> <properties> <pro Ject.build.sourceencoding>utf-8</project.build.sourceencoding> <project.reporting.outputencoding >UTF-8</project.reporting.outputEncoding> <java.version>1.7</java.version> </properties&    Gt            <dependencies> <dependency> <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> &LT;ARTIFACTID&GT;SPRING-BOOT-STARTER-WEB&LT;/ARTIFAC Tid> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <art Ifactid>spring-boot-starter-test</artifactid> <scope>test</scope> &LT;/DEPENDENCY&G    T </dependencies> <build> <plugins> <plugin> <groupid>org.            Springframework.boot</groupid> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>

(5) Start the project, right-springbootapplication class, Run as-java application, console output is as follows:

  

 (6) Start the Postman test as follows:

  

Springboot Quick Start

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.