From c2192a14aa61ffd0477502507e8eb9c96bec0294 Mon Sep 17 00:00:00 2001 From: Xiong Neng Date: Sun, 2 Sep 2018 16:33:02 +0800 Subject: [PATCH] upgrade springboot-aop to spring boot 2 --- README.md | 17 ++-- springboot-aop/pom.xml | 16 +--- .../com/xncoding/{aop => }/Application.java | 2 +- .../com/xncoding/aop/AfterStartRunner.java | 26 ++++++ .../src/main/resources/application.yml | 7 +- springboot-aop/src/main/resources/banner.txt | 23 +++++ .../src/main/resources/logback-spring.xml | 88 +++++++++++++++++++ 7 files changed, 152 insertions(+), 27 deletions(-) rename springboot-aop/src/main/java/com/xncoding/{aop => }/Application.java (91%) create mode 100644 springboot-aop/src/main/java/com/xncoding/aop/AfterStartRunner.java create mode 100644 springboot-aop/src/main/resources/banner.txt create mode 100644 springboot-aop/src/main/resources/logback-spring.xml diff --git a/README.md b/README.md index eb6353a..7f12376 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,12 @@ Spring Boot 现在已经成为Java 开发领域的一颗璀璨明珠,它本身 每个子项目都会使用最小依赖,大家拿来即可使用,自己可以根据业务需求自由组合搭配不同的技术构建项目。 +加粗提醒:**主分支基于Spring Boot 2构建!** + ## 项目简介 ![](https://xnstatic-1253397658.file.myqcloud.com/SpringBootBucket.png) - ## 子项目列表 每个子项目会配有一篇博客文章的详细讲解 :point_right: @@ -48,13 +49,16 @@ springboot-echarts | [集成Echarts导出图片](https://www.xncoding.c ## 环境 -* maven latest -* jdk 1.8 -* spring boot 1.5.10 release -* intellij idea +* JDK 1.8 +* Maven latest +* Spring Boot 2.0.4 +* Intellij IDEA * mysql 5.7 +* mongodb * git 版本管理 * nginx 反向代理 +* redis 缓存 +* rabbitmq 消息队列 ## 运行 @@ -77,9 +81,8 @@ springboot-echarts | [集成Echarts导出图片](https://www.xncoding.c ## 后续计划 1. 集成OAuth2认证 -1. 集成QQ、微信、新浪微博第三方登录,配合shiro使用 +1. 集成GitHub、微信等第三方登录 1. 集成网络爬虫框架 -1. 等SpringBoot 2稳定后全部升级至2 ## 问题反馈 diff --git a/springboot-aop/pom.xml b/springboot-aop/pom.xml index 22c9d1e..afc6248 100644 --- a/springboot-aop/pom.xml +++ b/springboot-aop/pom.xml @@ -15,8 +15,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.10.RELEASE - + 2.0.4.RELEASE @@ -53,7 +52,6 @@ maven-compiler-plugin 3.6.1 - 1.8 1.8 @@ -73,18 +71,6 @@ - - - - src/main/resources - - - src/main/java - - **/*.xml - - - diff --git a/springboot-aop/src/main/java/com/xncoding/aop/Application.java b/springboot-aop/src/main/java/com/xncoding/Application.java similarity index 91% rename from springboot-aop/src/main/java/com/xncoding/aop/Application.java rename to springboot-aop/src/main/java/com/xncoding/Application.java index bb292a5..2a00aac 100644 --- a/springboot-aop/src/main/java/com/xncoding/aop/Application.java +++ b/springboot-aop/src/main/java/com/xncoding/Application.java @@ -1,4 +1,4 @@ -package com.xncoding.aop; +package com.xncoding; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/springboot-aop/src/main/java/com/xncoding/aop/AfterStartRunner.java b/springboot-aop/src/main/java/com/xncoding/aop/AfterStartRunner.java new file mode 100644 index 0000000..33814c1 --- /dev/null +++ b/springboot-aop/src/main/java/com/xncoding/aop/AfterStartRunner.java @@ -0,0 +1,26 @@ +package com.xncoding.aop; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +/** + * MonitorBossAfterStart + * + * @author XiongNeng + * @version 1.0 + * @since 2018/7/18 + */ +@Component +@Order(1) +public class AfterStartRunner implements CommandLineRunner { + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + public void run(String... args) { + logger.debug("after start debug..."); + logger.info("after start info..."); + } +} diff --git a/springboot-aop/src/main/resources/application.yml b/springboot-aop/src/main/resources/application.yml index 0602e80..7da7211 100644 --- a/springboot-aop/src/main/resources/application.yml +++ b/springboot-aop/src/main/resources/application.yml @@ -20,8 +20,7 @@ spring: logging: level: - ROOT: INFO - com: - xncoding: DEBUG - file: E:/logs/aop.log + root: INFO + com.xncoding: DEBUG + path: D:/logs/springboot-aop diff --git a/springboot-aop/src/main/resources/banner.txt b/springboot-aop/src/main/resources/banner.txt new file mode 100644 index 0000000..859b78f --- /dev/null +++ b/springboot-aop/src/main/resources/banner.txt @@ -0,0 +1,23 @@ + + _____ _______ _____ _____ + /\ \ /::\ \ /\ \ /\ \ + /::\____\ /::::\ \ /::\____\ /::\ \ + /:::/ / /::::::\ \ /:::/ / /::::\ \ + /:::/ / /::::::::\ \ /:::/ / /::::::\ \ + /:::/ / /:::/~~\:::\ \ /:::/ / /:::/\:::\ \ + /:::/ / /:::/ \:::\ \ /:::/____/ /:::/__\:::\ \ + /:::/ / /:::/ / \:::\ \ |::| | /::::\ \:::\ \ + /:::/ / /:::/____/ \:::\____\ |::| | _____ /::::::\ \:::\ \ + /:::/ / |:::| | |:::| | |::| | /\ \ /:::/\:::\ \:::\ \ +/:::/____/ |:::|____| |:::| | |::| | /::\____\/:::/__\:::\ \:::\____\ +\:::\ \ \:::\ \ /:::/ / |::| | /:::/ /\:::\ \:::\ \::/ / + \:::\ \ \:::\ \ /:::/ / |::| | /:::/ / \:::\ \:::\ \/____/ + \:::\ \ \:::\ /:::/ / |::|____|/:::/ / \:::\ \:::\ \ + \:::\ \ \:::\__/:::/ / |:::::::::::/ / \:::\ \:::\____\ + \:::\ \ \::::::::/ / \::::::::::/____/ \:::\ \::/ / + \:::\ \ \::::::/ / ~~~~~~~~~~ \:::\ \/____/ + \:::\ \ \::::/ / \:::\ \ + \:::\____\ \::/____/ \:::\____\ + \::/ / ~~ \::/ / + \/____/ \/____/ + diff --git a/springboot-aop/src/main/resources/logback-spring.xml b/springboot-aop/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..e389878 --- /dev/null +++ b/springboot-aop/src/main/resources/logback-spring.xml @@ -0,0 +1,88 @@ + + + + springboot-aop + + + + + + + + + ${logPath}/springboot-aop.log + + + + ${logPath}/springboot-aop-%d{yyyy-MM-dd}.%i.log + + 128MB + + + 30 + + true + + %d{yyyy-MM-dd HH:mm:ss.SSS} %p ${PID:-} --- [%15thread] %logger:%-3L : %msg%n + utf-8 + + + info + ACCEPT + DENY + + + + + ${logPath}/springboot-aop-error.log + + + + ${logPath}/springboot-aop-error-%d{yyyy-MM-dd}.%i.log + + 2MB + + + 180 + + true + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %p ${PID:-} --- [%15thread] %logger:%-3L : %msg%n + utf-8 + + + + + ERROR + + ACCEPT + + DENY + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %p ${PID:-} --- [%15thread] %logger:%-3L : %msg%n + utf-8 + + + + DEBUG + + + + + + + + + + + + + + + \ No newline at end of file