All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jxrisesun.framework.cloud.gateway.config.SentinelConfig Maven / Gradle / Ivy

package com.jxrisesun.framework.cloud.gateway.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;

import com.jxrisesun.framework.cloud.gateway.handler.SentinelFallbackHandler;

/**
 * 网关限流配置
 * 
 * @author jxrisesun
 */
@Configuration
@ConditionalOnProperty(value = "spring.cloud.sentinel.enabled", havingValue = "true", matchIfMissing = true)
public class SentinelConfig implements InitializingBean {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(SentinelConfig.class);
	
	@Bean
	@Order(Ordered.HIGHEST_PRECEDENCE)
	public SentinelFallbackHandler sentinelGatewayExceptionHandler() {
		return new SentinelFallbackHandler();
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		LOGGER.info("---------- [rs-framework-cloud-gateway] Sentinel Enabled ----------");
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy