Commit 211d88cef8d4dcb25dd0b3ee927421bf6fa7359e

Authored by miaoguoxin
1 parent 584096c3

增加logback配置,简化mybatis配置

gateway-business/src/main/java/com/diligrp/xtrade/business/XtradeGatewayApplication.java
... ... @@ -16,6 +16,7 @@ import org.springframework.cloud.context.config.annotation.RefreshScope;
16 16 public class XtradeGatewayApplication {
17 17  
18 18 public static void main(String[] args) {
  19 + //用于追踪netty异常
19 20 //ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED);
20 21 SpringApplication.run(XtradeGatewayApplication.class, args);
21 22 }
... ...
gateway-business/src/main/resources/bootstrap.yml
... ... @@ -19,7 +19,9 @@ spring:
19 19 location: banner2.txt
20 20 mybatis:
21 21 mapper-locations: classpath:/mapper/*.xml
22   - config-location: classpath:/mybatis-config.xml
  22 + configuration:
  23 + call-setters-on-nulls: true
  24 + cache-enabled: true
23 25 xtrade:
24 26 gateway-loader: cloud
25 27 aggregation-scan-packages: com.diligrp.xtrade.business.application
... ...
gateway-business/src/main/resources/logback.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<configuration>
  3 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  4 + <encoder>
  5 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %level %logger{30}:%L - %msg%n</pattern>
  6 + </encoder>
  7 + </appender>
  8 + <appender name="File" class="ch.qos.logback.core.rolling.RollingFileAppender">
  9 + <file>/var/logs/gateway-service.log</file>
  10 +
  11 + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
  12 + <fileNamePattern>/var/logs/gateway-service.%i.log</fileNamePattern>
  13 + <minIndex>1</minIndex>
  14 + <maxIndex>10</maxIndex>
  15 + </rollingPolicy>
  16 +
  17 + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  18 + <maxFileSize>10MB</maxFileSize>
  19 + </triggeringPolicy>
  20 + <encoder>
  21 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %level %logger{30}:%L - %msg%n</pattern>
  22 + </encoder>
  23 + </appender>
  24 +
  25 + <!-- <logger name="com.example.demo.order" additive="true">
  26 + <level value="INFO" />
  27 + <appender-ref ref="File" />
  28 + </logger>-->
  29 +
  30 + <root level="INFO">
  31 + <appender-ref ref="File" />
  32 + <appender-ref ref="STDOUT" />
  33 + </root>
  34 +</configuration>
... ...
gateway-business/src/main/resources/mybatis-config.xml deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8" ?>
2   -<!DOCTYPE configuration
3   - PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
4   - "http://mybatis.org/dtd/mybatis-3-config.dtd">
5   -
6   -<configuration>
7   -<settings>
8   - <!-- 只设置需要的,其他使用默认值
9   - 开启二级缓存,相当于关闭一级缓存,防止分布式一级缓存无法共享 -->
10   - <setting name="cacheEnabled" value="true"/>
11   - <!-- 在null时也调用 setter,适应于返回Map,3.2版本以上可用 -->
12   - <setting name="callSettersOnNulls" value="true"/>
13   - <!-- 打印sql语句 调试使用-->
14   - <!-- <setting name="logImpl" value="STDOUT_LOGGING" />-->
15   - </settings>
16   - <!-- <plugins>
17   - <plugin interceptor="com.simida.infrastructure.common.page.PageHelper"/>
18   - </plugins>-->
19   -</configuration>
20 0 \ No newline at end of file