我正在尝试使用 JPA 存储库在 Spring Cloud Netflix Zuul 中配置速率限制。但是一开始我收到这个异常:java.sql.SQLSyntaxErrorException:表“kirillbq_bl_acc.rate”不存在我的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”表来存储有关请求的信息,但是我找不到有关该表结构的任何信息。应该是什么?
1 回答
万千封印
TA贡献1891条经验 获得超3个赞
我找到了此信息: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在此表中保存有关请求的信息。
添加回答
举报
0/150
提交
取消