Skip to content

Instantly share code, notes, and snippets.

@rubykv
Created June 28, 2021 14:00
Show Gist options
  • Save rubykv/93239f50ef003bed1a425c3eeaf37885 to your computer and use it in GitHub Desktop.
Save rubykv/93239f50ef003bed1a425c3eeaf37885 to your computer and use it in GitHub Desktop.
Sentinel
@Configuration
public class TestConfiguration {
@Bean
public SentinelResourceAspect sentinelResourceAspect() {
return new SentinelResourceAspect();
}
@PostConstruct
public void init() {
setFlowRules();
}
private void setFlowRules() {
List<FlowRule> flowRules = new ArrayList<>();
FlowRule flowRule = new FlowRule();
flowRule.setGrade(RuleConstant.FLOW_GRADE_QPS);
flowRule.setCount(1);
flowRules.add(flowRule);
FlowRuleManager.loadRules(flowRules);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment