diff --git a/spring-cloud/spring-cloud-aws/README.md b/spring-cloud/spring-cloud-aws/README.md
index bf33728c74..ddcc97420f 100644
--- a/spring-cloud/spring-cloud-aws/README.md
+++ b/spring-cloud/spring-cloud-aws/README.md
@@ -23,7 +23,6 @@ Let's say that the RDS instance is called `spring-cloud-test-db` having the mast
to write the following in `application.properties`:
```
-cloud.aws.rds.spring-cloud-test-db
cloud.aws.rds.spring-cloud-test-db.password=se3retpass
```
Multiple application classes are available under this project. To launch InstanceProfileAwsApplication application, replace `start-class` under `pom.xml`:
diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml
index abf9363288..2b05020888 100644
--- a/spring-cloud/spring-cloud-aws/pom.xml
+++ b/spring-cloud/spring-cloud-aws/pom.xml
@@ -10,9 +10,9 @@
com.baeldung
- parent-boot-1
+ parent-boot-2
0.0.1-SNAPSHOT
- ../../parent-boot-1
+ ../../parent-boot-2
@@ -43,6 +43,12 @@
org.postgresql
postgresql
+
+
+ mysql
+ mysql-connector-java
+
+
@@ -60,7 +66,7 @@
com.baeldung.spring.cloud.aws.SpringCloudAwsApplication
Dalston.SR4
- 2.0.1.RELEASE
+ 2.2.1.RELEASE
diff --git a/spring-cloud/spring-cloud-aws/src/main/java/com/baeldung/spring/cloud/aws/s3/SpringCloudS3.java b/spring-cloud/spring-cloud-aws/src/main/java/com/baeldung/spring/cloud/aws/s3/SpringCloudS3.java
index cfad6e904f..acfd6d339e 100644
--- a/spring-cloud/spring-cloud-aws/src/main/java/com/baeldung/spring/cloud/aws/s3/SpringCloudS3.java
+++ b/spring-cloud/spring-cloud-aws/src/main/java/com/baeldung/spring/cloud/aws/s3/SpringCloudS3.java
@@ -1,12 +1,5 @@
package com.baeldung.spring.cloud.aws.s3;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.ResourceLoader;
-import org.springframework.core.io.WritableResource;
-import org.springframework.core.io.support.ResourcePatternResolver;
-import org.springframework.stereotype.Component;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -14,14 +7,29 @@ import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.aws.core.io.s3.PathMatchingSimpleStorageResourcePatternResolver;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.core.io.WritableResource;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.stereotype.Component;
+
+import com.amazonaws.services.s3.AmazonS3;
+
@Component
public class SpringCloudS3 {
@Autowired
ResourceLoader resourceLoader;
+ private ResourcePatternResolver resourcePatternResolver;
+
@Autowired
- ResourcePatternResolver resourcePatternResolver;
+ public void setupResolver(ApplicationContext applicationContext, AmazonS3 amazonS3) {
+ this.resourcePatternResolver = new PathMatchingSimpleStorageResourcePatternResolver(amazonS3, applicationContext);
+ }
public void downloadS3Object(String s3Url) throws IOException {
Resource resource = resourceLoader.getResource(s3Url);
diff --git a/spring-cloud/spring-cloud-aws/src/main/resources/application.properties b/spring-cloud/spring-cloud-aws/src/main/resources/application.properties
index 690eda13a2..e8139326b9 100644
--- a/spring-cloud/spring-cloud-aws/src/main/resources/application.properties
+++ b/spring-cloud/spring-cloud-aws/src/main/resources/application.properties
@@ -2,7 +2,6 @@ cloud.aws.credentials.accessKey=YourAccessKey
cloud.aws.credentials.secretKey=YourSecretKey
cloud.aws.region.static=us-east-1
-cloud.aws.rds.spring-cloud-test-db
cloud.aws.rds.spring-cloud-test-db.password=se3retpass
# These 3 properties are optional