diff --git a/weblog-springboot-003/pom.xml b/weblog-springboot-003/pom.xml new file mode 100644 index 0000000..8dadf60 --- /dev/null +++ b/weblog-springboot-003/pom.xml @@ -0,0 +1,109 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + + 2.6.3 + + + + com.quanxiaoha + weblog-springboot + ${revision} + weblog-springboot + + 前后端分离博客 Weblog By 犬小哈 + + + pom + + + + + weblog-web + + weblog-module-admin + + weblog-module-common + + + + + + + 0.0.1-SNAPSHOT + 1.8 + UTF-8 + + ${java.version} + ${java.version} + + + 1.18.28 + 31.1-jre + 3.12.0 + + + + + + + com.quanxiaoha + weblog-module-admin + ${revision} + + + + com.quanxiaoha + weblog-module-common + ${revision} + + + + + com.google.guava + guava + ${guava.version} + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + + + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + diff --git a/weblog-springboot-003/weblog-module-admin/.gitignore b/weblog-springboot-003/weblog-module-admin/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/weblog-springboot-003/weblog-module-admin/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/weblog-springboot-003/weblog-module-admin/pom.xml b/weblog-springboot-003/weblog-module-admin/pom.xml new file mode 100644 index 0000000..8256d34 --- /dev/null +++ b/weblog-springboot-003/weblog-module-admin/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + + com.quanxiaoha + weblog-springboot + ${revision} + + + com.quanxiaoha + weblog-module-admin + weblog-module-admin + weblog-admin (负责管理后台相关功能) + + + + com.quanxiaoha + weblog-module-common + + + + + org.projectlombok + lombok + true + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + \ No newline at end of file diff --git a/weblog-springboot-003/weblog-module-admin/src/test/java/com/quanxiaoha/weblog/admin/WeblogModuleAdminApplicationTests.java b/weblog-springboot-003/weblog-module-admin/src/test/java/com/quanxiaoha/weblog/admin/WeblogModuleAdminApplicationTests.java new file mode 100644 index 0000000..dab9a4b --- /dev/null +++ b/weblog-springboot-003/weblog-module-admin/src/test/java/com/quanxiaoha/weblog/admin/WeblogModuleAdminApplicationTests.java @@ -0,0 +1,13 @@ +package com.quanxiaoha.weblog.admin; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class WeblogModuleAdminApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/weblog-springboot-003/weblog-module-common/.gitignore b/weblog-springboot-003/weblog-module-common/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/weblog-springboot-003/weblog-module-common/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/weblog-springboot-003/weblog-module-common/pom.xml b/weblog-springboot-003/weblog-module-common/pom.xml new file mode 100644 index 0000000..4c562a3 --- /dev/null +++ b/weblog-springboot-003/weblog-module-common/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + + com.quanxiaoha + weblog-springboot + ${revision} + + + com.quanxiaoha + weblog-module-common + weblog-module-common + weblog-module-common (此模块用于存放一些通用的功能) + + + + + org.projectlombok + lombok + true + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + diff --git a/weblog-springboot-003/weblog-module-common/src/test/java/com/quanxiaoha/weblog/common/WeblogModuleCommonApplicationTests.java b/weblog-springboot-003/weblog-module-common/src/test/java/com/quanxiaoha/weblog/common/WeblogModuleCommonApplicationTests.java new file mode 100644 index 0000000..8e92175 --- /dev/null +++ b/weblog-springboot-003/weblog-module-common/src/test/java/com/quanxiaoha/weblog/common/WeblogModuleCommonApplicationTests.java @@ -0,0 +1,13 @@ +package com.quanxiaoha.weblog.common; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class WeblogModuleCommonApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/weblog-springboot-003/weblog-web/.gitignore b/weblog-springboot-003/weblog-web/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/weblog-springboot-003/weblog-web/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/weblog-springboot-003/weblog-web/pom.xml b/weblog-springboot-003/weblog-web/pom.xml new file mode 100644 index 0000000..b674a19 --- /dev/null +++ b/weblog-springboot-003/weblog-web/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + + com.quanxiaoha + weblog-springboot + ${revision} + + + com.quanxiaoha + weblog-web + weblog-web + weblog-web (入口项目,负责博客前台展示相关功能,打包也放在这个模块负责) + + + + com.quanxiaoha + weblog-module-common + + + + com.quanxiaoha + weblog-module-admin + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.projectlombok + lombok + true + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/weblog-springboot-003/weblog-web/src/main/java/com/example/weblog/web/WeblogWebApplication.java b/weblog-springboot-003/weblog-web/src/main/java/com/example/weblog/web/WeblogWebApplication.java new file mode 100644 index 0000000..cd9a9d6 --- /dev/null +++ b/weblog-springboot-003/weblog-web/src/main/java/com/example/weblog/web/WeblogWebApplication.java @@ -0,0 +1,13 @@ +package com.example.weblog.web; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class WeblogWebApplication { + + public static void main(String[] args) { + SpringApplication.run(WeblogWebApplication.class, args); + } + +} diff --git a/weblog-springboot-003/weblog-web/src/main/resources/application-dev.yml b/weblog-springboot-003/weblog-web/src/main/resources/application-dev.yml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/weblog-springboot-003/weblog-web/src/main/resources/application-dev.yml @@ -0,0 +1 @@ + diff --git a/weblog-springboot-003/weblog-web/src/main/resources/application-prod.yml b/weblog-springboot-003/weblog-web/src/main/resources/application-prod.yml new file mode 100644 index 0000000..655a604 --- /dev/null +++ b/weblog-springboot-003/weblog-web/src/main/resources/application-prod.yml @@ -0,0 +1,5 @@ +#================================================================= +# log 日志 +#================================================================= +logging: + config: classpath:logback-weblog.xml diff --git a/weblog-springboot-003/weblog-web/src/main/resources/application.yml b/weblog-springboot-003/weblog-web/src/main/resources/application.yml new file mode 100644 index 0000000..175a1bd --- /dev/null +++ b/weblog-springboot-003/weblog-web/src/main/resources/application.yml @@ -0,0 +1,4 @@ +spring: + profiles: + # 默认激活 dev 环境 + active: prod diff --git a/weblog-springboot-003/weblog-web/src/main/resources/logback-weblog.xml b/weblog-springboot-003/weblog-web/src/main/resources/logback-weblog.xml new file mode 100644 index 0000000..d8389f8 --- /dev/null +++ b/weblog-springboot-003/weblog-web/src/main/resources/logback-weblog.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + ${LOG_FILE}-%i.log + + 30 + + + 10MB + + + + + ${FILE_LOG_PATTERN} + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/weblog-springboot-003/weblog-web/src/test/java/com/example/weblog/web/WeblogWebApplicationTests.java b/weblog-springboot-003/weblog-web/src/test/java/com/example/weblog/web/WeblogWebApplicationTests.java new file mode 100644 index 0000000..fa00b11 --- /dev/null +++ b/weblog-springboot-003/weblog-web/src/test/java/com/example/weblog/web/WeblogWebApplicationTests.java @@ -0,0 +1,26 @@ +package com.example.weblog.web; + +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +@Slf4j +class WeblogWebApplicationTests { + + @Test + void contextLoads() { + } + + @Test + void testLog() { + log.info("这是一行 Info 级别日志"); + log.warn("这是一行 Warn 级别日志"); + log.error("这是一行 Error 级别日志"); + + // 占位符 + String author = "犬小哈"; + log.info("这是一行带有占位符日志,作者:{}", author); + } + +}