maven打jar包

https://baijiahao.baidu.com/s?id=1736118238879426685&wfr=spider&for=pc

右侧maven->
项目名
    Lifecycle
        package 右键 run Maven build 在./target目录下 和成xxx.jar包


运行jar包
java -jar xxx.jar

maven启动spring boot

https://www.cnblogs.com/xues/p/11810095.html

mvn spring-boot:run -X
mvn install

gradle spring boot 项目运行的三种方式

https://www.cnblogs.com/new-moon/p/9974526.html

1、java -jar

2、Java Application

3、命令行 gradle bootRun
gradle build #编译

HelloWorld 的java文件

package com.example.demo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController //方法都以json格式输出
public class HelloController {

    @RequestMapping("/hello")
    public String hello() {
        return "Hello World!";
    }
}