MarcGiffing / bucket4j-spring-boot-starter

Spring Boot Starter for Bucket4j
Apache License 2.0
296 stars 62 forks source link

How can reactive programming be enabled for key-cache? #289

Open MarcGiffing opened 4 months ago

MarcGiffing commented 4 months ago

Discussed in https://github.com/MarcGiffing/bucket4j-spring-boot-starter/discussions/286

Originally posted by **dwang2** April 7, 2024 I have developed a reactive security service to retrieve the current user's name using the code snippet provided below. How can I formulate a key-cache expression to asynchronously fetch the username > @Service public class SecurityService { public Mono username() { return ReactiveSecurityContextHolder.getContext() .map(securityContext -> { Authentication authentication = securityContext.getAuthentication(); return authentication != null ? authentication.getName() : null; }); } }
dwang2 commented 4 months ago

Given that we are using Spring version 2.7.x, could you please extend support to version 0.8.x as well? This aligns with the current version I'm using.