idea菜单栏:文件 - > New-> Project ...
注:具体细节讲解,暂省Spring Boot官网
第一步:1.Spring Initializr(初始者)2.jdk版本3.Next
被墙了,不能下载,所以直接去官网下载一个Demo。
https://start.spring.io/
填写好Group和Artifact,其他默认即可。
然后下载好生成的Demo
Spring Boot项目目录结构
第六步:可以查看Maven Project的依赖(若加载慢,点击左上角的刷新按钮)(末尾附录,pom.xml)
第七步:maven编译(跳过测试),clean install -Dmaven.test.skip = true
配置编译参数:
maven编译:
下载maven依赖,jar包,编译,日志:
第八步:启动Spring Boot项目
Spring Boot启动日志:
注:spring boot有内嵌web服务器tomcat,并且以8080端口启动
第九步:访问测试 - 这不是错误,只是没有添加数据接口
附录1:pom.xml中
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.loveshare</groupId>
<artifactId>spring-boot-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-boot-1</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<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>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>