org.zodiac.autoconfigure.sentinel.feign.DefaultNacosFeignRuleInitializer Maven / Gradle / Ivy
package org.zodiac.autoconfigure.sentinel.feign;
import org.springframework.context.ConfigurableApplicationContext;
import org.zodiac.autoconfigure.feign.annotation.EnableFeignConsumers;
import org.zodiac.core.application.ApplicationInfo;
import org.zodiac.sentinel.feign.config.FeignSentinelConfigInfo;
import org.zodiac.sentinel.feign.support.nacos.BaseNacosFeignRuleInitializer;
public class DefaultNacosFeignRuleInitializer extends BaseNacosFeignRuleInitializer {
public DefaultNacosFeignRuleInitializer(ApplicationInfo applicationInfo,
FeignSentinelConfigInfo feignSentinelConfigInfo, ConfigurableApplicationContext applicationContext) {
super(applicationInfo, feignSentinelConfigInfo, applicationContext);
}
@Override
protected boolean isFeignClientEnabled(Class> mainClass) {
EnableFeignConsumers enableFeignConsumersAnnotation = mainClass.getAnnotation(EnableFeignConsumers.class);
return null != enableFeignConsumersAnnotation;
}
@Override
protected String[] getFeignClientDeclaredPackages(Class> mainClass) {
EnableFeignConsumers enableFeignConsumersAnnotation = mainClass.getAnnotation(EnableFeignConsumers.class);
String[] feignClientDeclaredPackages = enableFeignConsumersAnnotation.basePackages();
return feignClientDeclaredPackages;
}
}