搭建簡單的springboot專案
搭建簡單的springboot專案,基於springboot2.0.5版本實現(現公司使用的是springboot1.3.5version)
1、使用eclipse搭建springboot專案的先裝STO外掛(https://blog.csdn.net/wang20y8/article/details/83094793)
2、右鍵new==>project
3、在search框中輸入spring,如圖:
點選next
4、點選next以後會出現下圖:
其中就不一一贅述了,不懂留言,直接next:
點選finish。
二、新建立的專案結構:
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>
<groupId>com.heque</groupId>
<artifactId>sbt</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>sbt</name>
<description>sbt</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.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-tomcat</artifactId>
<scope>provided</scope>
</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>
開啟SbtApplication檔案:
點選右鍵run as
成功執行如下
加入tomcat下,亦能成功跑起來
寫了個簡單的controller