-
Notifications
You must be signed in to change notification settings - Fork 335
fix: add runtime hints for storage #2001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if (fileName.isPresent()) { | ||
GoogleStorageResource resource = | ||
new GoogleStorageResource( | ||
this.storage, String.format("gs://%s/%s", bucketName, fileName.get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider a private Resource getResource(Optional<String> filename)
function to reduce the duplication in this method and writeGcs
.
@GetMapping(value = "/")
public String readGcsFile(@RequestParam("filename") Optional<String> fileName)
throws IOException {
Resource resource = getResource(fileName);
return StreamUtils.copyToString(resource.getInputStream(), Charset.defaultCharset()) + "\n";
}
...-storage-resource-sample/src/test/java/com/example/GcsSampleApplicationIntegrationTests.java
Show resolved
Hide resolved
...loud-gcp-integration-storage-sample/src/test/java/com/example/GcsSpringIntegrationTests.java
Outdated
Show resolved
Hide resolved
...amples/spring-cloud-gcp-storage-resource-sample/src/main/java/com/example/WebController.java
Outdated
Show resolved
Hide resolved
...amples/spring-cloud-gcp-storage-resource-sample/src/main/java/com/example/WebController.java
Outdated
Show resolved
Hide resolved
spring-cloud-gcp-storage/src/main/resources/META-INF/spring/aot.factories
Outdated
Show resolved
Hide resolved
...egration-storage-sample/src/test/java/com/example/GcsSpringIntegrationTestConfiguration.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Check shortened fixedDelay
- Refactor get() call to have in-scope isPresent() call.
- Keep or replace
aot.factories
Kudos, SonarCloud Quality Gate passed! |
Builds on top of CI setup in #1933. Will rebase once its merged in.
This pr:
storage/integration/aot/StorageIntegrationRuntimeHint.java
.spring-native
profile inpom.xml
spring-cloud-gcp-samples/pom.xml
to run sample test in ci.CI:
mvn -Pspring-native,\!default clean test
. (adding this ci in fix: add runtime hints for vision #1991)[UPDATE] The reflection configuration is added in here because the
FileUtils
class in Spring Integration was callingcom.google.cloud.storage.Blob[]
(a child class of BlobInfo) reflectively usinggetClass()
. The FileUtils class is invoked byAbstractInboundFileSynchronizer
which is a parent ofGcsInboundFileSynchronizer
The stacktrace that helped with this discovery: