I used the following documentation to wire BasicAWSCredentials, KMSEncryptionMaterialsProvider, ClientConfiguration, and CryptoConfiguration into an AmazonS3EncryptionClient via XML configuration:
The last line of my XML configuration is something similar to:
<aws-context:context-resource-loader amazon-s3="myAmazonS3EncryptionClientBean"/>
Once I had everything wired-up using XML, I began refactoring in order to use all Java configuration, but couldn't figure out how to express the <aws-context:context-resource-loader> bean above in Java. I took a peek at the documentation and source, but nothing stood out. Any help/suggestions are appreciated!
After some internal research and discussions I was able to express <aws-context:context-resource-loader amazon-s3="myAmazonS3EncryptionClientBean"/> in Java configuration by autowiring a ResourceLoaderBeanPostProcessor that takes an AmazonS3 object in it's constructor.
@Bean
@Autowired
public static ResourceLoaderBeanPostProcessor resourceLoaderBeanPostProcessor(
AmazonS3Client amazonS3EncryptionClient) {
return new ResourceLoaderBeanPostProcessor(amazonS3EncryptionClient);
}
_Note_: This applies to 1.0.3.RELEASE+
In 1.1.3.RELEASE look at @EnableContextResourceLoader annotation.
I do think this should be covered in reference documentation
Most helpful comment
After some internal research and discussions I was able to express
<aws-context:context-resource-loader amazon-s3="myAmazonS3EncryptionClientBean"/>in Java configuration by autowiring aResourceLoaderBeanPostProcessorthat takes anAmazonS3object in it's constructor._Note_: This applies to 1.0.3.RELEASE+