Idea 使用Maven 创建Spring Boot 项目

本博客记录下如何用Idea 使用 Maven 创建 spring boot 项目,如有错误的地方欢迎提出。

1、File -> New -> Project

2、左侧选择Maven,右侧选的SDK,如果未显示则点击New -> 选择到你JDK安装的目录,然后下一步 next

3、填写GroupId、ArtifactId,这个地方仅作示例。填写完成以后 下一步 next

4、填写项目名称 和项目保存路径 然后 下一步 Finish

5、在项目中的Pom.xml文件中添加如下依赖,保存(初次添加需要下载,过程会有点儿慢,后面就会很快)

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

7、创建好Application之后调试运行

9、我们在浏览器中输入如下地址后可发现已经可以正确输出了,至此,一个简单的Spring Boot项目构建完成了

经验分享 程序员 微信小程序 职场和发展