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> <ARTIFACTID>SPRING-BOOT-STARTER-WEB</ARTIFAC Tid> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <art Ifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </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