refactor code
This commit is contained in:
parent
5b7a864ef2
commit
03f52e6329
|
@ -1,12 +0,0 @@
|
|||
package com.baeldung.caching.multicache;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class MultipleCachingApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MultipleCachingApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.caching.multicache;
|
||||
package com.baeldung.caching.twolevelcache;
|
||||
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import org.springframework.cache.CacheManager;
|
||||
|
@ -28,8 +28,7 @@ public class CacheConfig {
|
|||
@Primary
|
||||
public CacheManager caffeineCacheManager() {
|
||||
SimpleCacheManager manager = new SimpleCacheManager();
|
||||
manager.setCaches(Arrays.asList(
|
||||
caffeineCacheConfig()));
|
||||
manager.setCaches(Arrays.asList(caffeineCacheConfig()));
|
||||
return manager;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.caching.multicache;
|
||||
package com.baeldung.caching.twolevelcache;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.caching.multicache;
|
||||
package com.baeldung.caching.twolevelcache;
|
||||
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
|
@ -1,7 +1,6 @@
|
|||
package com.baeldung.caching.multicache;
|
||||
package com.baeldung.caching.twolevelcache;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
|
||||
public interface CustomerRepository extends CrudRepository<Customer, String> {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.caching.multicache;
|
||||
package com.baeldung.caching.twolevelcache;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
|
@ -1,5 +1,10 @@
|
|||
package com.baeldung.caching.redis;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -19,11 +24,6 @@ import javax.annotation.PreDestroy;
|
|||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@Import({ CacheConfig.class, ItemService.class })
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ImportAutoConfiguration(classes = { CacheAutoConfiguration.class, RedisAutoConfiguration.class })
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
package com.baeldung.caching.multicache;
|
||||
package com.baeldung.caching.twolevelcache;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
@ -21,11 +26,6 @@ import java.io.IOException;
|
|||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@Import({ CacheConfig.class,CustomerService.class })
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ImportAutoConfiguration(classes = { CacheAutoConfiguration.class, RedisAutoConfiguration.class })
|
Loading…
Reference in New Issue