yml配置文件:
- server:
- port: 8080
- servlet:
- context-path: /
-
- spring:
- application:
- name: demo3
- datasource:
- driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://localhost:3306/demo3?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
- username: root
- password: root
复制代码 pom.xml
- <?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 https://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>3.5.11</version>
- <relativePath/> <!-- lookup parent from repository -->
- </parent>
- <groupId>com.jinhei</groupId>
- <artifactId>demo3</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <name>demo3</name>
- <description>demo3</description>
- <url/>
- <licenses>
- <license/>
- </licenses>
- <developers>
- <developer/>
- </developers>
- <scm>
- <connection/>
- <developerConnection/>
- <tag/>
- <url/>
- </scm>
- <properties>
- <java.version>21</java.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <!-- 添加 MyBatis 依赖 -->
- <dependency>
- <groupId>org.mybatis.spring.boot</groupId>
- <artifactId>mybatis-spring-boot-starter</artifactId>
- <version>3.0.5</version>
- </dependency>
- <!-- 添加 MySQL 驱动 -->
- <dependency>
- <groupId>com.mysql</groupId>
- <artifactId>mysql-connector-j</artifactId>
- <!-- 用于指定依赖项的作用范围为 运行时。这意味着该依赖仅在项目运行时可用,而不会参与编译阶段。-->
- <scope>runtime</scope>
- </dependency>
- <!-- 添加 MyBatis 测试依赖 -->
- <dependency>
- <groupId>org.mybatis.spring.boot</groupId>
- <artifactId>mybatis-spring-boot-starter-test</artifactId>
- <version>3.0.5</version>
- <scope>test</scope>
- </dependency>
- <!-- 添加 Spring Boot 测试依赖 -->
- <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>
复制代码
demo3.zip
(35.41 KB, 下载次数: 0, 售价: 50 金币)
|