SpringBoot搭建Demo
看了很多公司都使用了Spring boot,今天心血来潮 搭建一下:
一、下载STS
首先到http://spring.io/tools/sts/all下载Spring boot集成工具STS,有各种版本,我下载windows版的
spring-tool-suite-3.9.4.RELEASE-e4.7.3a-win32-x86_64.zip
二、解压到指定位置
三、安装jdk1.7以上
四、安装maven
直接下载解压,配置MAVEN_HOME,添加到path
五、配置maven
这样配置maven后,maven下载和编译将飞速。
六、新增spring配置文件
配置信息:
application.properties---> spring.profiles.active=dev
application-dev.properties --->server.port=8081
七、新建一个Controller:
package com.lwl.demo1.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class SampleController {
@RequestMapping("/")
String home() {
return "Hello World!";
}
}
直接以javaApplication 启动SpringBootDemo1Application.java:
SpringBootDemo1Application
八、访问