简述下java环境
1.安装jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.安装eclipse
https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/neon/3/eclipse-jee-neon-3-win32-x86_64.zip
3.新建一个maven项目
file-->new-->project-->maven project
4.根据springboot官网的配置配pom.xml
http://projects.spring.io/spring-boot/
需要注意的是 spring boot 1.5.2的最新版会有maven关联包引入问题
请使用1.5.1
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.1.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
5.新建java类
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); } }