Configure the URL Access frequency limit and url Access Frequency
Configure the Access frequency limit of a URL to learn how to configure the Access frequency limit of a URL. It can be used to publish only two articles and money-related interfaces in an hour.
This guide guides you through configuring URL Access frequency limits.
How to complete this guide
You can start from scratch and complete each step, or you can bypass the basic setup steps you are already familiar. Either way, you can finally get the code that can work.
Configuration
Src/main/java/io/leopard/site/web/controller/FrequencyController. java
Package io. leopard. site. web. controller; import io. leopard. web4j. view. jsonView; import org. springframework. stereotype. controller; import org. springframework. web. bind. annotation. requestMapping; import io. leopard. web4j. method. annotation. frequency;/*** example of Access Frequency limit ** @ author **/@ Controllerpublic class FrequencyController {@ frequency (seconds = 1) @ RequestMappingpublic JsonView Frequency (long money) {return new JsonView ("increase the amount of money:" + money );}}
Summary
Congratulations! You have learned how to configure the URL Access frequency limit. Good luck.