com.alibaba.csp.sentinel.dashboard.controller.v2.FlowControllerV2中
@Autowired // @Qualifier("flowRuleDefaultProvider") @Qualifier("flowRuleNacosProvider") private DynamicRuleProvider<List<FlowRuleEntity>> ruleProvider; @Autowired // @Qualifier("flowRuleDefaultPublisher") @Qualifier("flowRuleNacosPublisher") private DynamicRulePublisher<List<FlowRuleEntity>> rulePublisher;
打开 /Sentinel-1.6.2/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html文件,修改代码:
<!--<li ui-sref-active="active">--> <!--<a ui-sref="dashboard.flow({app: entry.app})">--> <!--<i></i> 流控规则 V1</a>--> <!--</li>--> --- 改为 <li ui-sref-active="active"> <a ui-sref="dashboard.flow({app: entry.app})"> <i></i> NACOS 流控规则 V1</a> </li>Dashboard中要修改的代码已经好了。
重新启动 Sentinel-dashboard mvn clean package -DskipTests
测试效果
Sentinel 添加流控规则:
Nacos 查看同步的配置: