# POM.XML
<!--继承父项目spring-boot-starter-parent的依赖管理--> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.6</version> </parent> <!--导入web配置 启动器--> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
# 创建启动主程序类 :: mainApplication 启动项目直接启动这个主程序
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; // 主程序 @SpringBootApplication public class mainApplication { public static void main(String[] args) { SpringApplication.run(mainApplication.class,args); } }
# 第一个接口 package start.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class helloSpring { @RequestMapping("/hello") public String helloworld(){ return "hello springboot"; } }
标签:spring,boot,springframework,public,org,import,目录 From: https://www.cnblogs.com/wanghong1994/p/17015031.html