查看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
三步走

SpringBoot快速入门
本文介绍如何通过Spring官网或IDEA快速构建SpringBoot项目,演示了创建控制器并访问的方法,同时展示了将项目打包为jar文件及运行的步骤。
3969

被折叠的 条评论
为什么被折叠?



