You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

63 lines
2.0 KiB

/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有,侵权必究!
*/
package com.epmet;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.aspect.ServletExceptionHandler;
import com.epmet.commons.tools.config.RedissonConfig;
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.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import javax.annotation.PostConstruct;
import java.util.List;
/**
* 网关服务
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
//@ServletComponentScan(basePackages = "com.epmet")
@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ThreadDispatcherConfig.class, ServletExceptionHandler.class}))
public class GatewayApplication {
@Autowired
private CpProperty cpProperty;
@Autowired
private RedisUtils redisUtils;
public static void main(String[] 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));
}
}
}