添加启动类
@SpringBootApplication public class SpringBootMain { public static void main(String[] args) { SpringApplication.run(SpringBootMain.class, args); } }
添加依赖
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.2.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent>
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency>
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
添加测试代码
@RestController @RequestMapping("/t1") public class Test01 { @GetMapping("/a0") public Object test01(){ return new HashMap<>(); } }
标签:java,springboot,项目,spring,boot,springframework,org,public,starter From: https://www.cnblogs.com/qq376324789/p/18020757