On Spring Boot

Source: Internet
Author: User

On the introduction of some open source projects have seen many times the spring boot word, can not be specific to see, today first simple run through the process:p

Looking back on our previous use of the spring framework, we need to first add dependency dependencies (and basically the same as using gradle) to the Pom file (if you use Maven) and then create a new spring-related XML file, often with fewer XML files. Then continue to use Tomcat or jetty as a container to run the project. Basically creating a new project every time is such a process, and we sometimes just want to quickly create a spring Web project to test something, or hope to save time Springmvc4 MyBatis Integration Framework Source bootstrap HTML5 .

Now we can do this quickly with spring boot.

1. Create a MAVEN project, and then we add dependencies to the Pom.xml file:

<dependency> <groupId>org.springframework.boot</groupId> <artifactId> Spring-boot-starter-web</artifactid> <version>1.0.2.RELEASE</version></dependency>

2. Write a controller to process the request:

package  springboot.wiki.melon.springboottest;import org.springframework.boot.SpringApplication;import  org.springframework.boot.autoconfigure.enableautoconfiguration;import  org.springframework.stereotype.controller;import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod;import  Org.springframework.web.bind.annotation.responsebody;@[email protected] class firstcontroller  {@ResponseBody @requestmapping (value =  "Hello", method = {  requestmethod.post,requestmethod.get }) Public string hello ()  {return  "hello  Melon! hello spring boot ! ";} Public static void main (String[] args)  {springapplication.run (FirstController.class,  args);}} 

3.run! Then visit Localhost:8080/hello to see what the controller has returned, and this process is not very fast and easy:p

. ____          _            __ _ _

/\\ / ___‘_ __ _ _(_)_ __ __ _ \ \ \ \

( ( )\___ | ' _ | ' _| | ' _ \ _ ' | \ \ \ \

\\/  ___)| |_)| | | | | ||  (_| | ) ) ) )

' |____|. __|_| |_|_| |_\__, | / / / /

=========|_|==============|___/=/_/_/_/

:: Spring Boot:: (v1.0.2.release)

--eof--



On Spring Boot

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.