1

我正在将 Grails 应用程序部署到 Cloud Foundry,其中可搜索插件“compassConnection”设置为使用 RAM 索引。问题是 Cloud Foundry 应用了一些神奇的自动配置来将“compassConnection”设置为使用基于文件的索引。

如果我使用基于磁盘的索引并且 Cloud Foundry 需要重新配置以使其在其环境中工作但我希望 RAM 索引配置保持原样,这会很好。

有什么想法可以让我完成这项工作吗?

谢谢,奥利

4

1 回答 1

2

在浏览 AbstractCloudBeanPostprocessor 中的 Cloud Foundry 插件源代码后,我找到了问题的原因。填充罗盘连接的方法不检查它是否是 RAM 索引,而是盲目地将其设置到磁盘上的某个位置。

    /**
 * Update the location of the Searchable Lucene index.
 * @param beanFactory the Spring bean factory
 * @param appConfig the application config
 */
protected void fixCompass(ConfigurableListableBeanFactory beanFactory, ConfigObject appConfig) {
    def compassBean = beanFactory.getBeanDefinition('compass')
    String indexLocation = getCompassIndexRootLocation(appConfig) + '/searchable-index'
    appConfig.searchable.compassConnection = indexLocation
    compassBean.propertyValues.addPropertyValue 'compassConnection', indexLocation
    log.debug "Updated Compass connection details: $indexLocation"
}

我认为这应该真正检查 RAM 索引的存在,并且只将其设置为磁盘位置。一种可能的解决方法是创建我自己的 BeanDefinitionRegistryPostProcessor 并撤消 Cloud Foundry 插件所做的事情。

于 2013-01-10T09:24:21.493 回答