MCPcopy Create free account
hub / github.com/Jarrettluo/all-docs / MongoConfig

Class MongoConfig

src/main/java/com/jiaruiblog/config/MongoConfig.java:18–39  ·  view source on GitHub ↗

@ClassName MongoConfig @Description mongodb 配置 @Author luojiarui @Date 2022/7/12 10:30 下午 @Version 1.0

Source from the content-addressed store, hash-verified

16 * @Version 1.0
17 **/
18@Configuration
19public class MongoConfig {
20
21 /**
22 * 获取配置文件中数据库信息
23 */
24 @Value("${spring.data.mongodb.database}")
25 String db;
26
27 /**
28 * GridFSBucket用于打开下载流
29 *
30 * @param mongoClient MongoClient
31 * @return GridFSBucket
32 */
33 @Bean
34 public GridFSBucket getGridFsBucket(MongoClient mongoClient) {
35 MongoDatabase mongoDatabase = mongoClient.getDatabase(db);
36 return GridFSBuckets.create(mongoDatabase);
37 }
38
39}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected