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