Browse Source

common-quartz 通用模块提交

chenweida 7 years ago
parent
commit
340b1768bd

+ 34 - 0
common/common-log/src/main/resources/consoleAppender_logback_demo.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这个是根配置文件,一定要有的
    scan:是当配置文件被修改后会被重新加载
    scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。
    debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
-->
<configuration scan="true" scanPeriod="6000" debug="false">
    <root>
        <level value="INFO" />
    </root>
    <!--
    name:logger的名称
    level:输出级别是INFO
    additivity属性为false,表示此loger的打印信息不再向上级传递,是否继承父类的日志级别
    -->
    <logger name="demo1" level="INFO" additivity="false" >
        <appender-ref ref="dailyRollingFileAppender" />
    </logger>
    <!-- 演示按时间滚动的策略 -->
    <appender name="dailyRollingFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>${logbase}/usercenter.log</File>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- daily rollover -->
            <FileNamePattern>${logbase}/dailyRollingFileAppender.%d{yyyy-MM-dd}.log</FileNamePattern>
            <!-- 保留 30天数据,默认无限-->
            <maxHistory>30</maxHistory>
        </rollingPolicy>
        <encoder>
            <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg %n</Pattern>
        </encoder>
    </appender>
</configuration>

+ 28 - 0
common/common-log/src/main/resources/dailyRollingFileAppender_logback_demo.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 这个是根配置文件,一定要有的
    scan:是当配置文件被修改后会被重新加载
    scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。
    debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
-->
<configuration scan="true" scanPeriod="6000" debug="false">
    <root>
        <level value="INFO"/>
    </root>
    <!--
    name:logger的名称
    level:输出级别是INFO
    additivity属性为false,表示此loger的打印信息不再向上级传递,是否继承父类的日志级别
    -->
    <logger name="demo1" level="INFO" additivity="false">
        <appender-ref ref="dailyRollingFileAppender"/>
    </logger>
    <!-- 输出到控制面板 -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
        </encoder>
    </appender>
</configuration>

+ 47 - 0
common/common-swagger/src/main/java/com/yihu/jw/config/DefaultSwaggerConfig.java

@ -0,0 +1,47 @@
package com.yihu.jw.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import static com.google.common.base.Predicates.or;
import static springfox.documentation.builders.PathSelectors.regex;
@Configuration
@EnableSwagger2
public class DefaultSwaggerConfig {
    public static final String default_API = "default";
    @Bean
    public Docket defaultAPI() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(default_API)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(false)
                .pathMapping("/")
                .select()
                .paths(or(
                        regex("/.*")
                ))
                .build()
                .apiInfo(defaultApiInfo());
    }
    private ApiInfo defaultApiInfo() {
        ApiInfo apiInfo = new ApiInfo("API",
                "API,提供基础服务。",
                "1.0",
                "No terms of service",
                "wenfujian@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return apiInfo;
    }
}