Class ResourceDocumentSource
java.lang.Object
org.springframework.graphql.support.ResourceDocumentSource
- All Implemented Interfaces:
DocumentSource
DocumentSource
that looks for a document Resource
under a set
of locations and trying a number of different file extension.- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Field Summary
Modifier and TypeFieldDescriptionThe default file extensions, ".graphql" and ".gql". -
Constructor Summary
ConstructorDescriptionDefault constructor that sets the location to"classpath:graphql/"
and the extensions to ".graphql" and ".gql".ResourceDocumentSource
(List<Resource> locations, List<String> extensions) Constructor with given locations and extensions. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<String>
getDocument
(String name) Return the document that matches the given name.Return a read-only list with the file extensions to try when checking for documents by name.Return a read-only list with the configured locations where to check for documents.
-
Field Details
-
FILE_EXTENSIONS
The default file extensions, ".graphql" and ".gql".
-
-
Constructor Details
-
ResourceDocumentSource
public ResourceDocumentSource()Default constructor that sets the location to"classpath:graphql/"
and the extensions to ".graphql" and ".gql". -
ResourceDocumentSource
Constructor with given locations and extensions.- Parameters:
locations
- the resource locationsextensions
- the file extensions for document sources
-
-
Method Details
-
getLocations
Return a read-only list with the configured locations where to check for documents. -
getExtensions
Return a read-only list with the file extensions to try when checking for documents by name. -
getDocument
Description copied from interface:DocumentSource
Return the document that matches the given name.- Specified by:
getDocument
in interfaceDocumentSource
- Parameters:
name
- the name to use for the lookup- Returns:
Mono
that completes either with the document content or with an error, but never empty.
-