From f06b1f6296db642ffc76d9099a8260ea625f9230 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Sat, 13 Jun 2020 12:33:48 -0600 Subject: [PATCH] Fix formatting --- .../java/com/baeldung/caffeine/AddressController.java | 6 ++---- .../main/java/com/baeldung/caffeine/AddressService.java | 9 +++------ .../com/baeldung/caffeine/CaffeineConfiguration.java | 6 ++---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/AddressController.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/AddressController.java index eeb0cf89d3..1a48092451 100644 --- a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/AddressController.java +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/AddressController.java @@ -13,14 +13,12 @@ public class AddressController private AddressService addressService; @GetMapping("/address/{id}") - public ResponseEntity getAddress(@PathVariable("id") long customerId) - { + public ResponseEntity getAddress(@PathVariable("id") long customerId) { return ResponseEntity.ok(addressService.getAddress(customerId)); } @GetMapping("/address2/{id}") - public ResponseEntity getAddress2(@PathVariable("id") long customerId) - { + public ResponseEntity getAddress2(@PathVariable("id") long customerId) { return ResponseEntity.ok(addressService.getAddress2(customerId)); } } diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/AddressService.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/AddressService.java index 2096b60d93..595e7f410a 100644 --- a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/AddressService.java +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/AddressService.java @@ -19,17 +19,14 @@ public class AddressService private CacheManager cacheManager; @Cacheable(cacheNames = "addresses") - public String getAddress(long customerId) - { + public String getAddress(long customerId) { LOG.info("Method getAddress is invoked for customer {}", customerId); return "123 Main St"; } - public String getAddress2(long customerId) - { - if(cacheManager.getCache("addresses2").get(customerId) != null) - { + public String getAddress2(long customerId) { + if(cacheManager.getCache("addresses2").get(customerId) != null) { return cacheManager.getCache("addresses2").get(customerId).get().toString(); } diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/CaffeineConfiguration.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/CaffeineConfiguration.java index 45a8262282..575ae4a720 100644 --- a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/CaffeineConfiguration.java +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/caffeine/CaffeineConfiguration.java @@ -13,15 +13,13 @@ import java.util.concurrent.TimeUnit; @Configuration public class CaffeineConfiguration { @Bean - public Caffeine caffeineConfig() - { + public Caffeine caffeineConfig() { return Caffeine.newBuilder() .expireAfterWrite(60, TimeUnit.MINUTES); } @Bean - public CacheManager cacheManager(Caffeine caffeine) - { + public CacheManager cacheManager(Caffeine caffeine) { CaffeineCacheManager caffeineCacheManager = new CaffeineCacheManager(); caffeineCacheManager.getCache("addresses"); caffeineCacheManager.setCaffeine(caffeine);