This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.fasterxml.jackson.core.type.TypeReference; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import com.google.gson.Gson; | |
| import java.util.Collections; | |
| import java.util.List; | |
| public class DeepCloneExample { | |
| public static void main(String[] args) throws Exception { | |
| SourceBean source = new SourceBean(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import javax.annotation.Priority; | |
| import javax.ws.rs.WebApplicationException; | |
| import javax.ws.rs.container.ContainerRequestContext; | |
| import javax.ws.rs.container.ContainerRequestFilter; | |
| import javax.ws.rs.ext.Provider; | |
| import javax.ws.rs.ext.WriterInterceptor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.junit.jupiter.api.Assertions; | |
| import org.junit.jupiter.api.Test; | |
| import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; | |
| import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; | |
| import software.amazon.awssdk.regions.Region; | |
| import software.amazon.awssdk.services.sns.SnsClient; | |
| import software.amazon.awssdk.services.sns.model.CreateTopicRequest; | |
| import software.amazon.awssdk.services.sns.model.CreateTopicResponse; | |
| import software.amazon.awssdk.services.sns.model.PublishRequest; | |
| import software.amazon.awssdk.services.sns.model.PublishResponse; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
| import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | |
| import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
| import org.springframework.stereotype.Component; | |
| import org.springframework.web.servlet.config.annotation.CorsRegistry; | |
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.demo.spring.data.redis.cache.demo.SpringBootStarterDataRedisDemoApplication; | |
| import com.demo.spring.data.redis.cache.demo.domain.Photo; | |
| import org.junit.jupiter.api.Test; | |
| import org.junit.jupiter.api.extension.ExtendWith; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.test.context.SpringBootTest; | |
| import org.springframework.test.context.ActiveProfiles; | |
| import org.springframework.test.context.junit.jupiter.SpringExtension; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.demo.spring.data.redis.cache.demo.configuration; | |
| import com.demo.spring.data.redis.cache.demo.SpringBootStarterDataRedisDemoApplication; | |
| import org.junit.jupiter.api.Test; | |
| import org.junit.jupiter.api.extension.ExtendWith; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.test.context.SpringBootTest; | |
| import org.springframework.data.redis.cache.RedisCacheConfiguration; | |
| import org.springframework.data.redis.cache.RedisCacheManager; | |
| import org.springframework.test.context.ActiveProfiles; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Service | |
| public class PhotoService { | |
| @CachePut(cacheNames = "photo", key = "#photo.id") | |
| public Photo createPhoto(Photo photo) { | |
| return photo; | |
| } | |
| @Cacheable(cacheNames = "photo", key = "#id") | |
| public Photo findById(String id) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import lombok.Data; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.context.properties.ConfigurationProperties; | |
| import org.springframework.cache.CacheManager; | |
| import org.springframework.cache.annotation.CachingConfigurerSupport; | |
| import org.springframework.cache.annotation.EnableCaching; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.data.redis.cache.RedisCacheManager; | |
| import org.springframework.data.redis.connection.RedisStandaloneConfiguration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-data-redis</artifactId> | |
| </dependency> | |
| <dependency> | |
| <groupId>redis.clients</groupId> | |
| <artifactId>jedis</artifactId> | |
| <version>2.9.0</version> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cache: | |
| host: localhost | |
| port: 6379 | |
| default-ttl: 6000 | |
| caches-ttl: | |
| photo: 3600 |
NewerOlder