upgrade springboot-aop to spring boot 2

This commit is contained in:
Xiong Neng 2018-09-02 16:33:02 +08:00
parent 69a6a73663
commit c2192a14aa
7 changed files with 152 additions and 27 deletions

View File

@ -11,11 +11,12 @@ Spring Boot 现在已经成为Java 开发领域的一颗璀璨明珠,它本身
每个子项目都会使用最小依赖,大家拿来即可使用,自己可以根据业务需求自由组合搭配不同的技术构建项目。 每个子项目都会使用最小依赖,大家拿来即可使用,自己可以根据业务需求自由组合搭配不同的技术构建项目。
加粗提醒:**主分支基于Spring Boot 2构建**
## 项目简介 ## 项目简介
![](https://xnstatic-1253397658.file.myqcloud.com/SpringBootBucket.png) ![](https://xnstatic-1253397658.file.myqcloud.com/SpringBootBucket.png)
## 子项目列表 ## 子项目列表
每个子项目会配有一篇博客文章的详细讲解 :point_right: 每个子项目会配有一篇博客文章的详细讲解 :point_right:
@ -48,13 +49,16 @@ springboot-echarts | [集成Echarts导出图片](https://www.xncoding.c
## 环境 ## 环境
* maven latest * JDK 1.8
* jdk 1.8 * Maven latest
* spring boot 1.5.10 release * Spring Boot 2.0.4
* intellij idea * Intellij IDEA
* mysql 5.7 * mysql 5.7
* mongodb
* git 版本管理 * git 版本管理
* nginx 反向代理 * nginx 反向代理
* redis 缓存
* rabbitmq 消息队列
## 运行 ## 运行
@ -77,9 +81,8 @@ springboot-echarts | [集成Echarts导出图片](https://www.xncoding.c
## 后续计划 ## 后续计划
1. 集成OAuth2认证 1. 集成OAuth2认证
1. 集成QQ、微信、新浪微博第三方登录配合shiro使用 1. 集成GitHub、微信等第三方登录
1. 集成网络爬虫框架 1. 集成网络爬虫框架
1. 等SpringBoot 2稳定后全部升级至2
## 问题反馈 ## 问题反馈

View File

@ -15,8 +15,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version> <version>2.0.4.RELEASE</version>
<relativePath/>
</parent> </parent>
<properties> <properties>
@ -53,7 +52,6 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version> <version>3.6.1</version>
<configuration> <configuration>
<!--<proc>none</proc>-->
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
@ -73,18 +71,6 @@
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build> </build>
</project> </project>

View File

@ -1,4 +1,4 @@
package com.xncoding.aop; package com.xncoding;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -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...");
}
}

View File

@ -20,8 +20,7 @@ spring:
logging: logging:
level: level:
ROOT: INFO root: INFO
com: com.xncoding: DEBUG
xncoding: DEBUG path: D:/logs/springboot-aop
file: E:/logs/aop.log

View File

@ -0,0 +1,23 @@
_____ _______ _____ _____
/\ \ /::\ \ /\ \ /\ \
/::\____\ /::::\ \ /::\____\ /::\ \
/:::/ / /::::::\ \ /:::/ / /::::\ \
/:::/ / /::::::::\ \ /:::/ / /::::::\ \
/:::/ / /:::/~~\:::\ \ /:::/ / /:::/\:::\ \
/:::/ / /:::/ \:::\ \ /:::/____/ /:::/__\:::\ \
/:::/ / /:::/ / \:::\ \ |::| | /::::\ \:::\ \
/:::/ / /:::/____/ \:::\____\ |::| | _____ /::::::\ \:::\ \
/:::/ / |:::| | |:::| | |::| | /\ \ /:::/\:::\ \:::\ \
/:::/____/ |:::|____| |:::| | |::| | /::\____\/:::/__\:::\ \:::\____\
\:::\ \ \:::\ \ /:::/ / |::| | /:::/ /\:::\ \:::\ \::/ /
\:::\ \ \:::\ \ /:::/ / |::| | /:::/ / \:::\ \:::\ \/____/
\:::\ \ \:::\ /:::/ / |::|____|/:::/ / \:::\ \:::\ \
\:::\ \ \:::\__/:::/ / |:::::::::::/ / \:::\ \:::\____\
\:::\ \ \::::::::/ / \::::::::::/____/ \:::\ \::/ /
\:::\ \ \::::::/ / ~~~~~~~~~~ \:::\ \/____/
\:::\ \ \::::/ / \:::\ \
\:::\____\ \::/____/ \:::\____\
\::/ / ~~ \::/ /
\/____/ \/____/

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- scan 配置文件如果发生改变,将会被重新加载 scanPeriod 检测间隔时间-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>springboot-aop</contextName>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<!-- 日志存储级别 -->
<springProperty scope="context" name="rootlevel" source="logging.level.root" />
<springProperty scope="context" name="busilevel" source="logging.level.com.xncoding" />
<!-- 日志存储路径 -->
<springProperty scope="context" name="logPath" source="logging.path" />
<!-- 普通日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logPath}/springboot-aop.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志命名:单个文件大于128MB 按照时间+自增i 生成log文件 -->
<fileNamePattern>${logPath}/springboot-aop-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>128MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- 最大保存时间30天-->
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p ${PID:-} --- [%15thread] %logger:%-3L : %msg%n</pattern>
<charset>utf-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 错误日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logPath}/springboot-aop-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志命名:单个文件大于2MB 按照时间+自增i 生成log文件 -->
<fileNamePattern>${logPath}/springboot-aop-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- 最大保存时间180天-->
<maxHistory>180</maxHistory>
</rollingPolicy>
<append>true</append>
<!-- 日志格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p ${PID:-} --- [%15thread] %logger:%-3L : %msg%n</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 日志级别过滤器 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 控制台 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- 日志格式 -->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p ${PID:-} --- [%15thread] %logger:%-3L : %msg%n</pattern>
<charset>utf-8</charset>
</encoder>
<!--此日志appender是为开发使用只配置最底级别控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>
<!-- 屏蔽kafka的警告 -->
<logger name="org.apache.kafka" level="ERROR"/>
<!-- additivity 避免执行2次 -->
<logger name="com.xncoding" level="${busilevel}" additivity="false">
<appender-ref ref="STDOUT"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</logger>
<root level="${rootlevel}">
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</configuration>