Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 如何在Grails中使用自定义PropertyPlaceHolderConfigure_Spring_Grails_Grails 2.3_Grails 2.2 - Fatal编程技术网

Spring 如何在Grails中使用自定义PropertyPlaceHolderConfigure

Spring 如何在Grails中使用自定义PropertyPlaceHolderConfigure,spring,grails,grails-2.3,grails-2.2,Spring,Grails,Grails 2.3,Grails 2.2,我的项目创建war文件,这些文件部署在不同的tomcat实例中。我们扩展了Springs PropertyPlaceHolderConfigure以从Mongo读取属性,而不是在所有这些位置使用属性文件并记住更新这些文件中的属性值。这对于我们基于java/spring的战争非常有效。问题是试图让我们的grails应用程序使用这个bean。我已经在spring/resources.groovy(或xml)中包含了这个bean,但是grails并不尊重这个bean,它会被自己的GrialSpaceh

我的项目创建war文件,这些文件部署在不同的tomcat实例中。我们扩展了Springs PropertyPlaceHolderConfigure以从Mongo读取属性,而不是在所有这些位置使用属性文件并记住更新这些文件中的属性值。这对于我们基于java/spring的战争非常有效。问题是试图让我们的grails应用程序使用这个bean。我已经在spring/resources.groovy(或xml)中包含了这个bean,但是grails并不尊重这个bean,它会被自己的GrialSpaceholder配置器覆盖(或忽略)。有没有办法告诉grails使用我们自己的配置器

看来这是可能的。我从未使用过它,但在配置中添加以下代码应该可以:

beans {
    addBeanFactoryPostProcessor(new PropertyPlaceholderConfigurer())
}

另请参见grails源代码库。

我只需创建一个bean就可以解决这个问题。最初的开发人员不理解Grails。一旦我真正了解了它,我就能够让自定义配置程序正常工作。

谢谢。我试试看。