Commit 8ef7b71dfa2804813a528342f42b4190f2f45725

Authored by miaoguoxin
1 parent c8837dd3

增加properties参数校验

gateway-core/src/main/java/com/diligrp/xtrade/core/config/property/ApiMetricsProperties.java
... ... @@ -51,4 +51,13 @@ public class ApiMetricsProperties {
51 51 public void setTimeUnit(TimeUnit timeUnit) {
52 52 this.timeUnit = timeUnit;
53 53 }
  54 +
  55 + @Override
  56 + public String toString() {
  57 + return "ApiMetricsProperties{" +
  58 + "collectNum=" + collectNum +
  59 + ", timeout=" + timeout +
  60 + ", timeUnit=" + timeUnit +
  61 + '}';
  62 + }
54 63 }
... ...
gateway-core/src/main/java/com/diligrp/xtrade/core/config/property/DispatchProperties.java
... ... @@ -2,6 +2,9 @@ package com.diligrp.xtrade.core.config.property;
2 2  
3 3 import org.springframework.boot.context.properties.ConfigurationProperties;
4 4 import org.springframework.stereotype.Component;
  5 +import org.springframework.validation.annotation.Validated;
  6 +
  7 +import javax.validation.constraints.NotNull;
5 8  
6 9 /**
7 10 * @Auther: miaoguoxin
... ... @@ -9,8 +12,10 @@ import org.springframework.stereotype.Component;
9 12 */
10 13 @Component
11 14 @ConfigurationProperties(prefix = "xtrade")
  15 +@Validated
12 16 public class DispatchProperties {
13 17 /** 扫描包路径 */
  18 + @NotNull
14 19 private String[] aggregationScanPackages;
15 20  
16 21  
... ...
gateway-core/src/main/java/com/diligrp/xtrade/core/filters/factory/package-info.java 0 → 100644
  1 +/**
  2 + * @Auther: miaoguoxin
  3 + * @Date: 2018/12/8 12:47
  4 + * @Description: 类名一定要为filterName + GatewayFilterFactory,如定义为JwtCheckGatewayFilterFactory的话,它的filterName就是JwtCheck
  5 + */
  6 +package com.diligrp.xtrade.core.filters.factory;
... ...
gateway-core/src/main/java/com/diligrp/xtrade/core/support/ApiMetricsCollector.java
... ... @@ -16,6 +16,7 @@ import java.util.Timer;
16 16 import java.util.TimerTask;
17 17 import java.util.concurrent.ArrayBlockingQueue;
18 18 import java.util.concurrent.BlockingQueue;
  19 +import java.util.concurrent.Executors;
19 20 import java.util.concurrent.TimeUnit;
20 21 import java.util.concurrent.atomic.AtomicBoolean;
21 22  
... ...
gateway-core/src/main/java/com/diligrp/xtrade/core/support/dispatch/MappingRegister.java
... ... @@ -17,6 +17,7 @@ import org.springframework.boot.SpringApplication;
17 17 import org.springframework.context.ApplicationContext;
18 18 import org.springframework.context.ApplicationListener;
19 19 import org.springframework.context.event.ContextRefreshedEvent;
  20 +import org.springframework.lang.NonNullApi;
20 21 import org.springframework.stereotype.Component;
21 22 import org.springframework.validation.annotation.Validated;
22 23  
... ...