You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/_configprops.adoc
+9
Original file line number
Diff line number
Diff line change
@@ -46,14 +46,23 @@
46
46
|spring.cloud.aws.s3.accelerate-mode-enabled | | Option to enable using the accelerate endpoint when accessing S3. Accelerate endpoints allow faster transfer of objects by using Amazon CloudFront's globally distributed edge locations.
47
47
|spring.cloud.aws.s3.checksum-validation-enabled | | Option to disable doing a validation of the checksum of an object stored in S3.
48
48
|spring.cloud.aws.s3.chunked-encoding-enabled | | Option to enable using chunked encoding when signing the request payload for {@link software.amazon.awssdk.services.s3.model.PutObjectRequest} and {@link software.amazon.awssdk.services.s3.model.UploadPartRequest}.
|spring.cloud.aws.s3.config.reload.max-wait-for-restart | `+++2s+++` | If {@link ReloadStrategy#RESTART_CONTEXT} is configured, maximum waiting time for server restart.
51
+
|spring.cloud.aws.s3.config.reload.period | `+++1m+++` | Refresh period for {@link PollingAwsPropertySourceChangeDetector}.
52
+
|spring.cloud.aws.s3.config.reload.strategy | | Reload strategy to run when properties change.
|spring.cloud.aws.s3.crt.initial-read-buffer-size-in-bytes | | Configure the starting buffer size the client will use to buffer the parts downloaded from S3. Maintain a larger window to keep up a high download throughput; parts cannot download in parallel unless the window is large enough to hold multiple parts. Maintain a smaller window to limit the amount of data buffered in memory.
51
55
|spring.cloud.aws.s3.crt.max-concurrency | | Specifies the maximum number of S3 connections that should be established during transfer.
52
56
|spring.cloud.aws.s3.crt.minimum-part-size-in-bytes | | Sets the minimum part size for transfer parts. Decreasing the minimum part size causes multipart transfer to be split into a larger number of smaller parts. Setting this value too low has a negative effect on transfer speeds, causing extra latency and network communication for each part.
53
57
|spring.cloud.aws.s3.crt.target-throughput-in-gbps | | The target throughput for transfer requests. Higher value means more S3 connections will be opened. Whether the transfer manager can achieve the configured target throughput depends on various factors such as the network bandwidth of the environment and the configured `max-concurrency`.
|spring.cloud.aws.s3.endpoint | | Overrides the default endpoint.
56
64
|spring.cloud.aws.s3.path-style-access-enabled | | Option to enable using path style access for accessing S3 objects instead of DNS style access. DNS style access is preferred as it will result in better load balancing when accessing S3.
65
+
|spring.cloud.aws.s3.plugin.enable-fallback | `+++false+++` | If set to false if Access Grants does not find/return permissions, S3Client won't try to determine if policies grant access If set to true fallback policies S3/IAM will be evaluated.
57
66
|spring.cloud.aws.s3.region | | Overrides the default region.
58
67
|spring.cloud.aws.s3.transfer-manager.follow-symbolic-links | | Specifies whether to follow symbolic links when traversing the file tree in `S3TransferManager#uploadDirectory` operation.
59
68
|spring.cloud.aws.s3.transfer-manager.max-depth | | Specifies the maximum number of levels of directories to visit in `S3TransferManager#uploadDirectory` operation.
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/core.adoc
+9
Original file line number
Diff line number
Diff line change
@@ -260,3 +260,12 @@ There can be multiple customizer beans present in single application context and
260
260
261
261
Client-specific customizations can be applied through client-specific customizer interfaces (for example `S3ClientCustomizer` for S3). See integrations documentation for details.
262
262
263
+
264
+
=== GraalVM Native Image
265
+
266
+
Since version 3.3.0 the framework provides **experimental** support for GraalVM Native Image build.
267
+
268
+
Known issues are:
269
+
270
+
- in DynamoDB integration, `StaticTableSchema` must be used instead of `DynamicTableSchema` (see https://github.com/aws/aws-sdk-java-v2/issues/2445)
271
+
- in S3 integration, when working with CRT client, following guide must be followed: https://github.com/awslabs/aws-crt-java?tab=readme-ov-file#graalvm-support
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/s3.adoc
+225
Original file line number
Diff line number
Diff line change
@@ -378,6 +378,231 @@ There can be multiple `S3ClientCustomizer` beans present in single application c
378
378
379
379
Note that `S3ClientCustomizer` beans are applied **after** `AwsSyncClientCustomizer` beans and therefore can overwrite previously set configurations.
380
380
381
+
=== Loading External Configuration
382
+
383
+
Just like Spring Boot supports configuring application through `application.properties` stored in the file system, Spring Cloud AWS S3 integration extends this capability with fetching application configuration the S3 bucket through `spring.config.import` property.
384
+
385
+
For example, assuming that there is a file `config.properties` in a bucket named `bucket-name`, to include it as Spring Boot configuration, add a following property to `application.properties` or `application.yml`:
If a file with given name does not exist in S3, application will fail to start. If file configuration is not required for the application, and it should continue to startup even when file configuration is missing, add `optional` before prefix:
Fetched files configuration can be referenced with `@Value`, bound to `@ConfigurationProperties` classes, or referenced in `application.properties` file.
415
+
416
+
`JSON`, Java Properties and `YAML` configuration file formats are supported.
417
+
418
+
File resolved with `spring.config.import` can be also referenced in `application.properties`.
419
+
For example, with a file `config.json` containing following JSON structure:
420
+
421
+
[source,json]
422
+
----
423
+
{
424
+
"url": "someUrl"
425
+
}
426
+
----
427
+
428
+
429
+
`spring.config.import` entry is added to `application.properties`:
If you want to use autoconfigured `S3Client` but change underlying SDKClient or `ClientOverrideConfiguration` you will need to register bean of type `S3ClientCustomizer`:
481
+
Autoconfiguration will configure `S3Client` Bean with provided values after that, for example:
Some applications may need to detect changes on external property sources and update their internal status to reflect the new configuration.
512
+
The reload feature of Spring Cloud AWS S3 config import integration is able to trigger an application reload when a related file value changes.
513
+
514
+
By default, this feature is disabled. You can enable it by using the `spring.cloud.aws.s3.config.reload.strategy` configuration property (for example, in the `application.properties` file) and adding following dependencies.
The following levels of reload are supported (by setting the `spring.cloud.aws.s3.config.reload.strategy` property):
533
+
534
+
* `refresh` (default): Only configuration beans annotated with `@ConfigurationProperties` or `@RefreshScope` are reloaded.
535
+
This reload level leverages the refresh feature of Spring Cloud Context.
536
+
537
+
* `restart_context`: the whole Spring `ApplicationContext` is gracefully restarted. Beans are recreated with the new configuration.
538
+
In order for the restart context functionality to work properly you must enable and expose the restart actuator endpoint
539
+
[source,yaml]
540
+
====
541
+
----
542
+
management:
543
+
endpoint:
544
+
restart:
545
+
enabled: true
546
+
endpoints:
547
+
web:
548
+
exposure:
549
+
include: restart
550
+
----
551
+
====
552
+
553
+
Assuming that the reload feature is enabled with default settings (`refresh` mode), the following bean is refreshed when the file changes:
554
+
555
+
====
556
+
[java, source]
557
+
----
558
+
@Configuration
559
+
@ConfigurationProperties(prefix = "bean")
560
+
public class MyConfig {
561
+
562
+
private String message = "a message that can be changed live";
563
+
564
+
// getter and setters
565
+
566
+
}
567
+
----
568
+
====
569
+
570
+
To see that changes effectively happen, you can create another bean that prints the message periodically, as follows
571
+
572
+
====
573
+
[source,java]
574
+
----
575
+
@Component
576
+
public class MyBean {
577
+
578
+
@Autowired
579
+
private MyConfig config;
580
+
581
+
@Scheduled(fixedDelay = 5000)
582
+
public void hello() {
583
+
System.out.println("The message is: " + config.getMessage());
584
+
}
585
+
}
586
+
----
587
+
====
588
+
589
+
The reload feature periodically re-creates the configuration from S3 file to see if it has changed.
590
+
You can configure the polling period by using the `spring.cloud.aws.s3.config.reload.period` (default value is 1 minute).
591
+
592
+
=== Configuration
593
+
594
+
The Spring Boot Starter for S3 provides the following configuration options:
595
+
596
+
[cols="2,3,1,1"]
597
+
|===
598
+
| Name | Description | Required | Default value
599
+
| `spring.cloud.aws.s3.config.enabled` | Enables the S3 config import integration. | No | `true`
600
+
| `spring.cloud.aws.s3.config.reload.strategy` | `Enum` | `refresh` | The strategy to use when firing a reload (`refresh`, `restart_context`)
601
+
| `spring.cloud.aws.s3.config.reload.period` | `Duration`| `15s` | The period for verifying changes
602
+
| `spring.cloud.aws.s3.config.reload.max-wait-time-for-restart` | `Duration`| `2s` | The maximum time between the detection of changes in property source and the application context restart when `restart_context` strategy is used.
603
+
|===
604
+
605
+
381
606
=== IAM Permissions
382
607
383
608
Following IAM permissions are required by Spring Cloud AWS:
0 commit comments