|
@ -8,9 +8,15 @@ |
|
|
|
|
|
|
|
|
package com.epmet; |
|
|
package com.epmet; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.epmet.commons.tools.aspect.ServletExceptionHandler; |
|
|
import com.epmet.commons.tools.aspect.ServletExceptionHandler; |
|
|
import com.epmet.commons.tools.config.RedissonConfig; |
|
|
import com.epmet.commons.tools.config.RedissonConfig; |
|
|
import com.epmet.commons.tools.config.ThreadDispatcherConfig; |
|
|
import com.epmet.commons.tools.config.ThreadDispatcherConfig; |
|
|
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
|
|
|
import com.epmet.filter.CpProperty; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.boot.SpringApplication; |
|
|
import org.springframework.boot.SpringApplication; |
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
|
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
|
@ -18,6 +24,9 @@ import org.springframework.cloud.openfeign.EnableFeignClients; |
|
|
import org.springframework.context.annotation.ComponentScan; |
|
|
import org.springframework.context.annotation.ComponentScan; |
|
|
import org.springframework.context.annotation.FilterType; |
|
|
import org.springframework.context.annotation.FilterType; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 网关服务 |
|
|
* 网关服务 |
|
|
* |
|
|
* |
|
@ -31,7 +40,24 @@ import org.springframework.context.annotation.FilterType; |
|
|
@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ThreadDispatcherConfig.class, ServletExceptionHandler.class})) |
|
|
@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ThreadDispatcherConfig.class, ServletExceptionHandler.class})) |
|
|
public class GatewayApplication { |
|
|
public class GatewayApplication { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private CpProperty cpProperty; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
public static void main(String[] args) { |
|
|
SpringApplication.run(GatewayApplication.class, args); |
|
|
SpringApplication.run(GatewayApplication.class, args); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 初始化运营端校验资源列表 |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostConstruct |
|
|
|
|
|
public void initOperExamineResources() { |
|
|
|
|
|
if (!redisUtils.hasKey(RedisKeys.getOperExamineResourceUrls())) { |
|
|
|
|
|
List<CpProperty.OperExamineResource> operExamineResourceUrls = cpProperty.getOperExamineResourceUrls(); |
|
|
|
|
|
redisUtils.setString(RedisKeys.getOperExamineResourceUrls(), JSON.toJSONString(operExamineResourceUrls)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|