搭建简单的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