test: 限流、拒绝重发等

This commit is contained in:
2023-08-16 14:36:39 +08:00
parent 5b8ce749e5
commit 7a658ae401
4 changed files with 24 additions and 14 deletions

View File

@@ -62,17 +62,17 @@
<version>1.17.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
<!-- <dependency>-->
<!-- <groupId>org.jetbrains</groupId>-->
<!-- <artifactId>annotations</artifactId>-->
<!-- <version>13.0</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.codehaus.groovy</groupId>-->
<!-- <artifactId>groovy-all</artifactId>-->
<!-- <version>3.0.13</version>-->
<!-- <type>pom</type>-->
<!-- </dependency>-->
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>3.0.13</version>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>

View File

@@ -3,6 +3,7 @@ package org.nl;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
import com.alicp.jetcache.anno.config.EnableMethodCache;
import io.github.forezp.distributedlimitcore.annotation.Limit;
import io.swagger.annotations.Api;
import org.mybatis.spring.annotation.MapperScan;
import org.nl.common.annotation.RepeatSubmit;
@@ -13,11 +14,16 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.retry.annotation.Retryable;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalTime;
/**
* 开启审计功能 -> @EnableJpaAuditing
* https://www.cnblogs.com/niceyoo/p/10908647.html
@@ -35,6 +41,7 @@ import org.springframework.web.bind.annotation.RestController;
@EnableTransactionManagement
@EnableMethodCache(basePackages = "org.nl")
@EnableCreateCacheAnnotation
@EnableRetry
@MapperScan("org.nl.**.mapper")
public class AppRun {
@@ -62,8 +69,10 @@ public class AppRun {
*/
@GetMapping("/")
@SaIgnore
@RepeatSubmit(expirationTime = 10)
public String index() {
// @Limit(identifier = "forezp", key = "test", limtNum = 10, seconds = 1) // 用不了
// @Retryable(value = Exception.class,maxAttempts = 3,backoff = @Backoff(delay = 2000,multiplier = 1.5))
// @RepeatSubmit(expirationTime = 10)
public String index() throws Exception {
return "Backend service started successfully";
}
}

View File

@@ -35,7 +35,7 @@ public class SchBasePointController {
@GetMapping
@Log("查询点位管理")
@RepeatSubmit
// @RepeatSubmit
@ApiOperation("查询点位管理")
//@SaCheckPermission("@el.check('schBasePoint:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){

View File

@@ -1,5 +1,6 @@
server:
port: 8010
limit.type: redis
#配置数据源
spring:
datasource: