在使用GORM mongoDB插件的Grails应用程序中配置MongoDatastore类的bean覆盖的最佳方法是什么?

问题描述 投票:0回答:1

在使用GORM MongoDB插件的标准Grails应用程序中,如果您用新的MongoDatastore类(用于添加一些自定义行为)覆盖MongoDatastore类,例如:

class MyMongoDatastore extends MongoDatastore{ 

      here the override methods and property

}

并且您想配置它以供插件使用,最好的使用方法是什么?

mongodb grails gorm
1个回答
0
投票

resources.groovy中定义您要覆盖的bean和您要覆盖的类:

beans = {
    mongoDatastore(MyMongoDatastore)
}

https://docs.grails.org/latest/guide/spring.html

我以前没有使用过mongo-假设您的例子中这些名称正确。

© www.soinside.com 2019 - 2024. All rights reserved.