Skip to content

Commit 0101fc5

Browse files
authored
Merge pull request thombergs#93 from murtuza-ranapur/spring-redis-cache
Caching with Spring Cloud AWS and ElastiCache
2 parents 9f8e3f3 + 36e25d3 commit 0101fc5

23 files changed

Lines changed: 676 additions & 3 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM --platform=linux/amd64 adoptopenjdk/openjdk11:jre-11.0.10_9-alpine
2+
ARG JAR_FILE=build/libs/*.jar
3+
COPY ${JAR_FILE} service.jar
4+
EXPOSE 8080
5+
ENTRYPOINT [ "sh", "-c", "java -jar -XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 service.jar" ]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Caching In Spring Boot Application with ElastiCache for Redis
2+
3+
* This example showcases how you can configure spring cache and connect it with
4+
AWS ElastiCache
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
plugins {
2+
id 'org.springframework.boot' version '2.4.5'
3+
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
4+
id 'java'
5+
}
6+
7+
group = 'io.reflectoring'
8+
version = '0.0.1-SNAPSHOT'
9+
sourceCompatibility = '11'
10+
11+
configurations {
12+
compileOnly {
13+
extendsFrom annotationProcessor
14+
}
15+
}
16+
17+
repositories {
18+
mavenCentral()
19+
}
20+
21+
dependencies {
22+
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
23+
implementation 'org.springframework.boot:spring-boot-starter-validation'
24+
implementation 'org.springframework.boot:spring-boot-starter-web'
25+
implementation 'org.springframework.boot:spring-boot-starter-cache'
26+
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
27+
implementation 'io.awspring.cloud:spring-cloud-starter-aws'
28+
// implementation 'com.amazonaws:aws-java-sdk-cloudformation'
29+
implementation 'com.amazonaws:aws-java-sdk-elasticache'
30+
compileOnly 'org.projectlombok:lombok'
31+
runtimeOnly 'com.h2database:h2'
32+
annotationProcessor 'org.projectlombok:lombok'
33+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
34+
}
35+
36+
dependencyManagement {
37+
imports {
38+
mavenBom 'io.awspring.cloud:spring-cloud-aws-dependencies:2.3.1'
39+
}
40+
}
41+
42+
test {
43+
useJUnitPlatform()
44+
}
57.8 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

aws/spring-cloud-caching-redis/gradlew

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/spring-cloud-caching-redis/gradlew.bat

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'spring-cloud-redis'
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.reflectoring.springcloudredis;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class SpringCloudRedisApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(SpringCloudRedisApplication.class, args);
11+
}
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package io.reflectoring.springcloudredis.configuration;
2+
3+
import org.springframework.cache.annotation.EnableCaching;
4+
import org.springframework.context.annotation.Configuration;
5+
6+
@Configuration
7+
@EnableCaching
8+
public class EnableCache {
9+
10+
}

0 commit comments

Comments
 (0)