Polishing.

Add assertions and missing Override annotations. Avoid recursive self-call on getClassLoader. Extend documentation.

See #1627
Original pull request: #4389
This commit is contained in:
Mark Paluch
2023-05-26 14:47:02 +02:00
parent 4b78ef6523
commit 370b4145d2
3 changed files with 66 additions and 49 deletions

View File

@@ -3,7 +3,6 @@
MongoDB supports storing binary files inside its filesystem, GridFS. Spring Data MongoDB provides a `GridFsOperations` interface as well as the corresponding implementation, `GridFsTemplate`, to let you interact with the filesystem. You can set up a `GridFsTemplate` instance by handing it a `MongoDatabaseFactory` as well as a `MongoConverter`, as the following example shows:
====
.Java
[source,java,role="primary"]
@@ -82,7 +81,7 @@ class GridFsClient {
@Test
public void findFilesInGridFs() {
GridFSFindIterable result = operations.find(query(whereFilename().is("filename.txt")))
GridFSFindIterable result = operations.find(query(whereFilename().is("filename.txt")));
}
}
----
@@ -110,3 +109,7 @@ class GridFsClient {
====
`GridFsOperations` extends `ResourcePatternResolver` and lets the `GridFsTemplate` (for example) to be plugged into an `ApplicationContext` to read Spring Config files from MongoDB database.
NOTE: By default, `GridFsTemplate` obtains `GridFSBucket` once upon the first GridFS interaction.
After that, the Template instance reuses the cached bucket.
To use different buckets, from the same Template instance use the constructor accepting `Supplier<GridFSBucket>`.