有时候久了没开新项目了,重新开发一个新项目,搭建springboot的过程都有点淡忘了,所有温故知新。
从0开始搭建springboot
1.创建work空间。步骤FileàNewàJava Working Set。
2.选择Java Working Set。
3.自定义Working set name 名称。
点击Finish 完成工作空间创建。左侧出现文件夹:
4.新建Spring Starter Project
5.一个springboot的基本信息。
6.点击Next,选择依赖组件
7.点击Finish,完成创建。
版本选择
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<base.version>1.0-SNAPSHOT</base.version>
<java.version>1.8</java.version>
<spring-cloud.version>2021.0.1</spring-cloud.version>
<spring-boot.version>2.6.2</spring-boot.version>
<mysql.version>8.0.17</mysql.version>
<druid.version>1.1.13</druid.version>
<mybatisplus.version>3.4.3.4</mybatisplus.version>
<mybatis-spring.version>2.2.0</mybatis-spring.version>
<apollo.version>1.8.0</apollo.version>
<dameng.version>7.6.0.142</dameng.version>
<fastjson.version>1.2.83</fastjson.version>
<swagger2.version>2.9.2</swagger2.version>
<hutool.version>5.7.7</hutool.version>
<poi.version>4.1.2</poi.version>
<commons-lang3.version>3.8.1</commons-lang3.version>
<xstream.version>1.4.18</xstream.version>
<log4j-to-slf4j.version>2.15.0</log4j-to-slf4j.version>
<java-jwt.version>3.8.2</java-jwt.version>
<zxing.version>3.3.0</zxing.version>
<barcode4j.version>2.1</barcode4j.version>
<bcprov-jdk15to18.version>1.66</bcprov-jdk15to18.version>
<rocketmq.version>4.7.1</rocketmq.version>
<mq-http-sdk.version>1.0.3.2</mq-http-sdk.version>
<aliyun-sdk-oss.version>3.13.2</aliyun-sdk-oss.version>
<cos_api.version>5.6.89</cos_api.version>
<sharding-sphere.version>4.0.0-RC2</sharding-sphere.version>
<shardingsphere.version>5.0.0-beta</shardingsphere.version>
</properties>
pom依赖
<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>
<artifactId>xxx-member-plat</artifactId>
<groupId>cn.xxx</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>member-business</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>cn.ctg</groupId>
<artifactId>base-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.ctg</groupId>
<artifactId>base-interceptor</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- apollo -->
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>${apollo.version}</version>
</dependency>
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-core</artifactId>
<version>${apollo.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>${xstream.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatisplus.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!--oss -->
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>${aliyun-sdk-oss.version}</version>
</dependency>
<!--cos -->
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>${cos_api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>${rocketmq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-acl</artifactId>
<version>${rocketmq.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun.mq</groupId>
<artifactId>mq-http-sdk</artifactId>
<!--以下版本号请替换为Java SDK的最新版本号-->
<version>${mq-http-sdk.version}</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
<!-- 分库分表 -->
<!--
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
<version>${sharding-sphere.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-namespace</artifactId>
<version>${sharding-sphere.version}</version>
</dependency>
-->
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<configuration>
<target>
<copy todir="../deploy" overwrite="true">
<fileset dir="${project.build.directory}">
<include name="${project.artifactId}.jar" />
</fileset>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
SpringBoot是一个基于Spring框架的开源JavaWeb开发框架,它简化了Spring应用的初始搭建以及开发过程。通过使用特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,SpringBoot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。
SpringBoot的主要优点包括:
总之,SpringBoot是一个简化Spring应用开发过程的框架,通过自动配置、嵌入式Web服务器等功能,使得开发者能够更加高效地进行JavaWeb应用的开发。
SpringBoot的优点主要体现在以下几个方面:
更多【spring-spring suite搭建springboot操作】相关视频教程:www.yxfzedu.com