链接:https://pan.baidu.com/s/1ma9TX38TabEbGdOyDSobvQ?pwd=s9zu
java -Dserver.port=8888 -Dcsp.sentinel.dashboard.server=localhost:8888 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.8.1.jar 
-
-
UTF-8 -
1.8 -
1.8 -
Hoxton.SR8 -
2.3.2.RELEASE -
2.2.4.RELEASE -
-
-
-
-
-
org.springframework.cloud -
spring-cloud-dependencies -
${spring-cloud.version} -
pom -
import -
-
-
org.springframework.boot -
spring-boot-dependencies -
${springboot.version} -
pom -
import -
-
-
com.alibaba.cloud -
spring-cloud-alibaba-dependencies -
${springcloudalibaba.version} -
pom -
import -
-
-
-
-
-
com.alibaba.cloud -
spring-cloud-starter-alibaba-sentinel -
-
-
-
org.springframework.boot -
spring-boot-starter-web -
-
-
-
com.alibaba.csp -
sentinel-core -
-
-
-
com.alibaba.csp -
sentinel-transport-simple-http -
1.8.0 -
-
-
-
com.alibaba.csp -
sentinel-annotation-aspectj -
1.8.0 -
-
-
-
com.alibaba.csp -
sentinel-parameter-flow-control -
1.4.0 -
-
-
-
com.alibaba.csp -
sentinel-datasource-nacos -
-
-


- /**
- * 添加配置类
- */
- @Configuration
- public class SentinelAspectConfiguration {
-
- @Bean
- public SentinelResourceAspect sentinelResourceAspect() {
- return new SentinelResourceAspect();
- }
- }
- /**
- * 注解方式定义资源
- * @SentinelResource value 资源名称
- * @SentinelResource blockHandler 调用被限流/降级/系统保护的时候调用的方法
- * @return
- */
- @SentinelResource(value = "helloWorld",blockHandler = "blockHandlerForHelloWorld")
- @RequestMapping("helloWorld")
- public String helloWorld(){
- return "Sentinel 大爷你好!by 注解方式@SentinelResource"+System.currentTimeMillis();
- }
-
- /**
- * 原方法调用被限流/降级/系统保护的时候调用
- * @param ex
- * @return
- */
- public String blockHandlerForHelloWorld(BlockException ex) {
- ex.printStackTrace();
- return "系统繁忙,请稍后!";
- }

















