gpt4 book ai didi

java - Spring Cloud Netflix Zuul。 SQLSyntaxErrorException : Table 'rate' doesn't exist

转载 作者:行者123 更新时间:2023-12-02 01:08:57 25 4
gpt4 key购买 nike

我正在尝试使用 JPA 存储库在我的 Spring Cloud Netflix Zuul 中配置速率限制。但是一开始我收到这个异常:

java.sql.SQLSyntaxErrorException: Table 'kirillbq_bl_acc.rate' doesn't exist

我的application.yaml:

zuul:
routes:
my-service:
path: /
ratelimit:
enabled: true
repository: JPA
policy-list:
my-service:
- limit: 2
refresh-interval: 60
type:
- origin
strip-prefix: true

我在项目中也有一个 spring-boot-starter-data-jpa 依赖项。

我假设 Zuul 需要一个'Rate' 表来存储有关请求的信息,但是我找不到有关该表结构的任何信息。应该是什么?

最佳答案

我找到了这个信息:https://www.programcreek.com/java-api-examples/?code=marcosbarbero/spring-cloud-zuul-ratelimit/spring-cloud-zuul-ratelimit-master/spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/RateLimitAutoConfiguration.java#

config文件夹中有Rate.java类,其结构为“Rate”表:

@Entity
public class Rate {

@Id
private String key;
private Long remaining;
private Long remainingQuota;
private Long reset;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss")
private Date expiration;

// constructor, getters and setters
}

创建此表后,一切正常。 Zuul在此表中保存有关请求的信息。

关于java - Spring Cloud Netflix Zuul。 SQLSyntaxErrorException : Table 'rate' doesn't exist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57707876/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com