pom.xml中的起始依赖:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
</parent>
<dependencies>
<!--web起步包
注意:虽然是web工程,但不需要打war包,直接打jar就行
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
创建Application程序入口类:
@SpringBootApplication
public Class mySpringBootApplication{
public static void main(String[] args) {
SpringApplication.run(mySpringBootApplication.class,args);
}
}
编写Controller
@RestController
public class demo {
@RequestMapping("demo")
public String test1() {
return "SpringBoot开始";
}
运行程序入口main方法