|
29 | 29 | import org.springframework.context.annotation.Bean;
|
30 | 30 | import org.springframework.context.annotation.Configuration;
|
31 | 31 | import org.springframework.context.annotation.Import;
|
| 32 | +import org.springframework.core.io.buffer.DataBufferFactory; |
| 33 | +import org.springframework.core.io.buffer.DefaultDataBufferFactory; |
32 | 34 | import org.springframework.data.mongodb.ReactiveMongoDatabaseFactory;
|
33 | 35 | import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
|
34 | 36 | import org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory;
|
|
37 | 39 | import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
|
38 | 40 | import org.springframework.data.mongodb.core.convert.NoOpDbRefResolver;
|
39 | 41 | import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
|
| 42 | +import org.springframework.data.mongodb.gridfs.ReactiveGridFsTemplate; |
40 | 43 |
|
41 | 44 | /**
|
42 | 45 | * {@link EnableAutoConfiguration Auto-configuration} for Spring Data's reactive mongo
|
|
49 | 52 | * to the {@literal test} database.
|
50 | 53 | *
|
51 | 54 | * @author Mark Paluch
|
| 55 | + * @author Artsiom Yudovin |
52 | 56 | * @since 2.0.0
|
53 | 57 | */
|
54 | 58 | @Configuration(proxyBeanMethods = false)
|
@@ -85,4 +89,20 @@ public MappingMongoConverter mappingMongoConverter(MongoMappingContext context,
|
85 | 89 | return mappingConverter;
|
86 | 90 | }
|
87 | 91 |
|
| 92 | + @Bean |
| 93 | + @ConditionalOnMissingBean |
| 94 | + public DefaultDataBufferFactory dataBufferFactory() { |
| 95 | + return new DefaultDataBufferFactory(); |
| 96 | + } |
| 97 | + |
| 98 | + @Bean |
| 99 | + @ConditionalOnMissingBean |
| 100 | + public ReactiveGridFsTemplate reactiveGridFsTemplate( |
| 101 | + ReactiveMongoDatabaseFactory reactiveMongoDbFactory, |
| 102 | + MappingMongoConverter mappingMongoConverter, |
| 103 | + DataBufferFactory dataBufferFactory) { |
| 104 | + return new ReactiveGridFsTemplate(dataBufferFactory, reactiveMongoDbFactory, |
| 105 | + mappingMongoConverter, null); |
| 106 | + } |
| 107 | + |
88 | 108 | }
|
0 commit comments