I have a class with a resource property of type Resource in spring (org.springframework.core.io.Resource) which takes a file object as input.

setResource(Resource resource) 
  {
     this.resource = resource;
  }

However, I am reading a remote document through another custom API which returns the contents of the document as a String.

String xml = document.getContent();

I want to pass this xml as Resource in my setResource method. However, I don't know how can I cast String into Resource.

Any ideas ??

Edit
Report