Add assertions and missing Override annotations. Avoid recursive self-call on getClassLoader. Extend documentation.
See #1627
Original pull request: #4389
@ -78,10 +83,15 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -78,10 +83,15 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@ -91,11 +101,16 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -91,11 +101,16 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@ -105,7 +120,7 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -105,7 +120,7 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@ -116,6 +131,7 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -116,6 +131,7 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
super(converter);
Assert.notNull(gridFSBucket,"GridFSBucket Mono must not be null");
Assert.notNull(dataBufferFactory,"DataBufferFactory must not be null");
this.bucketSupplier=gridFSBucket;
@ -128,6 +144,8 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -128,6 +144,8 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@ -258,15 +276,18 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -258,15 +276,18 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@ -289,6 +310,7 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -289,6 +310,7 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@ -326,21 +348,8 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -326,21 +348,8 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@ -348,19 +357,8 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -348,19 +357,8 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@ -368,13 +366,7 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
@@ -368,13 +366,7 @@ public class ReactiveGridFsTemplate extends GridFsOperationsSupport implements R
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 {
@@ -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 {
@@ -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>`.