spring boot 项目创建
你好! 这是你第一次使用 eclipse编辑器 创建spring boot项目,我们后续的所有项目都基于eclipse进行编译操作,由于本人长年使用eclipse形成习惯,当然你也可以使用IDEA最好的编辑器着手开发spring boot的项目。
Spring tools的安装
- 打开eclipse 编辑器,打开Help->Eclipse Marketplace->如图:
- 搜索 Spring tools* 功能。
如图:
选择安装就可以。
创建项目
1.点击项目右键选择“Spring Starter Project”
如图:
2.点击“Next”
3.一般默认的Spring boot 项目为**.Jar**
3.点击"Next"期间这个界面是你要选择的配置类,我们可以忽略,如图
4.点击"Finish"继续操作,一个Spring boot项目创建成功,结构,如图:
5.项目创建成功后的pom文件
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.qjc</groupId>
<artifactId>spring-boot-cretate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-boot-cretate</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</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>
6.启动项目
点击右键-》Run As-》Spring Boot App 项目启动
可以看到日志,如图:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.2.RELEASE)
2019-01-24 11:28:35.803 INFO 19312 --- [ main] com.qjc.SpringBootCretateApplication : Starting SpringBootCretateApplication on DESKTOP-580CUKI with PID 19312 (D:\J2EEBoot\eclipse-boot\spring-boot-cretate\target\classes started by joe in D:\J2EEBoot\eclipse-boot\spring-boot-cretate)
2019-01-24 11:28:35.807 INFO 19312 --- [ main] com.qjc.SpringBootCretateApplication : No active profile set, falling back to default profiles: default
2019-01-24 11:28:36.235 INFO 19312 --- [ main] com.qjc.SpringBootCretateApplication : Started SpringBootCretateApplication in 0.671 seconds (JVM running for 1.332)
7.项目源码地址
https://github.com/joecheng521/springboot/tree/master/spring-boot-cretate