查看SpringBoot最新版
快速启动方式1:官网快速构建springBoot(了解)
方式2 在idea中快速创建(以后都是使用这种方式)
编写一个controller并访问
package com.example.demo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello() {
return "hello world";
}
}
浏览器访问:http://localhost:8080/hello
将项目打包成jar:
使用idea查看jar的位置
在电脑上找到jar,在路径栏上输入cmd
输入:java -jar demo-0.0.1-SNAPSHOT.jar
浏览器访问
ps:在idea中启动jar
三步走