Guest User

Untitled

a guest
Jan 3rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xmlns:aws-context="http://www.springframework.org/schema/cloud/aws/context"
  3. xsi:schemaLocation="http://www.springframework.org/schema/cloud/aws/context http://www.springframework.org/schema/cloud/aws/context/spring-cloud-aws-context.xsd">
  4. <aws-context:context-credentials>
  5. <!-- ... -->
  6. </aws-context:context-credentials>
  7. <aws-context:context-resource-loader/>
  8. </beans>
  9.  
  10. public class SimpleResourceLoadingBean {
  11.  
  12. @Autowired
  13. private ResourceLoader resourceLoader;
  14.  
  15. public void writeResource() throws IOException {
  16. Resource resource = this.resourceLoader.getResource("s3://myBucket/rootFile.log");
  17. WritableResource writableResource = (WritableResource) resource;
  18. try (OutputStream outputStream = writableResource.getOutputStream()) {
  19. outputStream.write("test".getBytes());
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment