/SpringRateLimitter

Dummy RateLimitter for SpringWeb

Primary LanguageJava

Spring rate limitter

Small rate limitting library for rest controllers.

Idea: you can block your endpoints after some requests for specified period of time

Usage

  1. Add a depdendency to your maven project
         <dependency>
            <groupId>io.github.abondar24</groupId>
            <artifactId>SpringRateLimitter</artifactId>
            <version>0.0.2-SNAPSHOT</version>
         </dependency>
  1. Import RateConfig to your config or SpringBootApplication
@Import({RateConfig.class})
  1. Add property controller.package to your applicaiton.yml or application.properties
controller:
  package: package-name
  1. Add an exception handler for RateLimitException.

  2. Annotate controller or separate methods. Number of requests and period im milliseconds can be specified. Defalut values are 1000 requests and 1ms

Build

mvn clean install

Versions

  • 0.0.1 - basic rate limitter
  • 0.0.2 - added check for rate values