feat: 基本框架搭建.
This commit is contained in:
94
pom.xml
94
pom.xml
@@ -9,9 +9,99 @@
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- boot 版本 -->
|
||||
<boot.version>3.5.4</boot.version>
|
||||
<!-- lombok 版本 -->
|
||||
<lombok.version>1.18.34</lombok.version>
|
||||
<!-- mysql 驱动版本 -->
|
||||
<mysql-connector.version>9.4.0</mysql-connector.version>
|
||||
<!-- mybatis-plus 版本 -->
|
||||
<mybatis-plus.version>3.5.12</mybatis-plus.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- web starter -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mysql驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>${mysql-connector.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
<version>3.5.12</version>
|
||||
<exclusions>
|
||||
<!-- 排除jdbc, 手动引入最新版(暂未出现兼容性问题) -->
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</exclusion>
|
||||
|
||||
<!-- 排除旧版本 autoconfigure -->
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
<version>${boot.version}</version>
|
||||
<exclusions>
|
||||
<!-- 旧版本存在日志实现冲突, 排除hikari连接池中的旧版本,使用web starter中的新版. -->
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- lombok 代码生成: getter、setter等 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
23
src/main/java/com/serliunx/blog/PersonalBlogApplication.java
Normal file
23
src/main/java/com/serliunx/blog/PersonalBlogApplication.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.serliunx.blog;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* 启动类
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025/8/8
|
||||
*/
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@MapperScan("com.serliunx.blog.mapper")
|
||||
public class PersonalBlogApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PersonalBlogApplication.class, args);
|
||||
}
|
||||
}
|
||||
7
src/main/resources/application-dev.yml
Normal file
7
src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
server:
|
||||
port: 18080
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/personal_blog?autoReconnect=true&characterEncoding=utf8
|
||||
username: root
|
||||
# password: password, # 密码不建议写在配置文件中, 建议利用Idea中的配置覆盖, 如果是其他IDE请自行斟酌
|
||||
0
src/main/resources/application-local.yml
Normal file
0
src/main/resources/application-local.yml
Normal file
12
src/main/resources/application.yml
Normal file
12
src/main/resources/application.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
banner:
|
||||
location: banner/banner.txt
|
||||
charset: UTF-8
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
banner: false
|
||||
7
src/main/resources/banner/banner.txt
Normal file
7
src/main/resources/banner/banner.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
_________ .____ .__
|
||||
/ _____/ ___________| | |__|__ __ ____ ___ ___
|
||||
\_____ \_/ __ \_ __ \ | | | | \/ \\ \/ /
|
||||
/ \ ___/| | \/ |___| | | / | \> <
|
||||
/_______ /\___ >__| |_______ \__|____/|___| /__/\_ \
|
||||
\/ \/ \/ \/ \/ , PersonalBlog - 1.0.0, Supported by Spring Boot v${spring-boot.version}
|
||||
Reference in New Issue
Block a user