1、首先建立一個maven的web3.0項目。http://blog.csdn.net/u013066244/article/details/53737199java
2、修改pom.xml文件,加入spring boot的依賴web
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.4.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
3、把hello world程序放進去,從main方法啓動。spring
package hello; import org.springframework.boot.*; import org.springframework.boot.autoconfigure.*; import org.springframework.stereotype.*; import org.springframework.web.bind.annotation.*; @Controller @EnableAutoConfiguration public class SampleController { @RequestMapping("/") @ResponseBody String home() { return "Hello World!"; } public static void main(String[] args) throws Exception { SpringApplication.run(SampleController.class, args); } }
其餘連接:app
代碼和配置文件來自這裏: http://projects.spring.io/spring-boot/ 。1.5.4版本。maven