spring boot项目完成

This commit is contained in:
2026-03-02 15:27:52 +08:00
parent 433f28f8f0
commit 2b6b0e1bb5
10 changed files with 238 additions and 28 deletions

58
pom.xml
View File

@@ -20,6 +20,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Spring Boot 3 必须用 JDK 17+,否则编译报错 -->
<java.version>22</java.version>
</properties>
<dependencies>
@@ -37,5 +39,61 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- 2. MySQL 驱动(适配 Spring Boot 3运行时依赖 -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
<build>
<!-- 必须指定最终生成的 JAR 包名称(可选,但便于识别) -->
<finalName>javamemories</finalName>
<plugins>
<!-- 核心Spring Boot 打包插件(必须配置,否则无主清单) -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.3</version> <!-- 和你的 Spring Boot 版本一致 -->
<executions>
<!-- 必须添加这个 execution否则插件不会生效 -->
<execution>
<goals>
<goal>repackage</goal> <!-- 重新打包为可执行 JAR -->
</goals>
</execution>
</executions>
<!-- 可选:手动指定启动类(防止插件找不到) -->
<configuration>
<mainClass>cn.mayiming.App</mainClass> <!-- 替换为你的实际启动类全限定名 -->
</configuration>
</plugin>
</plugins>
</build>
</project>