环境
编辑器 idea
jdk 1.8
springboot 版本:1.5.10.RELEASE
第一步 新建springboot项目工程 什么都不说了直接上图
启动应用
浏览器输入 localhost:8080
新建一个 HelloWordConTroller 类
@Controller public class HelloWordConTroller { @GetMapping("/") @ResponseBody public String index(){ return "helloword"; } }再次输入localhost:8080
礼成
第二部分热部署
打开pom 文件
替换修改以下代码
1.修改前
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency>修改后
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional><scope>true</scope></dependency>第二处
<plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins>修改后
<plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration><!--此处为打包设置的--><executions> <execution><goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins>Crtl+Alt+S 打开设置
2、组合键:Shift+ALT+Ctrl+/ ,选择“Registry”,回车,找到“complier.automake.allow.when.app.running”至此热部署完成第三步 打包可以看到生成的文件cmd 至该目录 运行该jar 包java -jar springboot_demo-0.0.1-SNAPSHOT.jar第四步 springboot的另一种运行方式cmd 进入该项目目录输入mvn spring-boot:run运行springboot 项目GITHUB