IDEA配置SpringBoot--快速入门

1. 新建普通maven工程

2. 在pom.xml中添加父

<parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.1.0.RELEASEversion>
        <relativePath/> 
 parent>

此处需要注意artifactId的内容不能错:spring-boot-starter-parent
(刚开始写成了spring-boot-start-parent,导致一直报错…)
PS:如果写正确了还是报错,可能是镜像源的问题,可以更换为阿里云镜像

3. 导入web启动依赖

<dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
            <version>2.1.6.RELEASEversion>
        dependency>
dependencies>

4.创建引导类MySpringBootApplication

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

//添加该注解,表明这个是Springboot的引导类
@SpringBootApplication
public class MySpringBootApplication {
   
    public static void<

你可能感兴趣的:(JAVA,SpringBoot)