在使用GORM MongoDB插件的标准Grails应用程序中,如果您用新的MongoDatastore类(用于添加一些自定义行为)覆盖MongoDatastore类,例如:
class MyMongoDatastore extends MongoDatastore{
here the override methods and property
}
并且您想配置它以供插件使用,最好的使用方法是什么?
在resources.groovy
中定义您要覆盖的bean和您要覆盖的类:
beans = {
mongoDatastore(MyMongoDatastore)
}
https://docs.grails.org/latest/guide/spring.html
我以前没有使用过mongo-假设您的例子中这些名称正确。