springboot(2)- springboot 项目创建方法

    技术2022-07-10  161

    1 springboot 项目创建的3种方法

    1.1 在线创建

    https://start.spring.io/

    1.2 通过IDE创建

    1.2.1 IDEA创建 springboot项目

    1.2.2 STS 创建 springboot项目

    1.3 改造普通 maven 工程

    添加依赖 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.15.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> 添加启动类 package com.tzb; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @EnableAutoConfiguration public class App { @RequestMapping("/") public String hello(){ return "hello world"; } public static void main(String[] args) { SpringApplication.run(App.class, args); } }

    Processed: 0.013, SQL: 10