templates.gateway.GatewayConfig.ftl Maven / Gradle / Ivy
package ${packageName}.gateway.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import ${packageName}.gateway.filter.RequestGlobalFilter;
import ${packageName}.gateway.handler.GlobalExceptionHandler;
/***
* 网关配置
*
* @author Co.
* @date: 2022/10/15 11:19
* @return
*/
@Configuration
public class GatewayConfig {
@Value("${r'${yesaiot.request-legal-time:0}'}")
private long requestLegalTimes;
@Bean
public RequestGlobalFilter requestGlobalFilter() {
return new RequestGlobalFilter(requestLegalTimes);
}
@Bean
public GlobalExceptionHandler globalExceptionHandler(ObjectMapper objectMapper) {
return new GlobalExceptionHandler(objectMapper);
}
}