Grails message.properties更改在部署的应用程序中不起作用 [英] Grails message.properties changes not taking effect in deployed application

查看:98
本文介绍了Grails message.properties更改在部署的应用程序中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在tomcat 7上部署了一个Grails应用程序,真的很烦人



我在我的网站上创建了一个基本上允许网站管理员编辑message.properties的工具以便他可以根据自己的需要更改某种语言的消息。



所有更改都成功保存到他编辑的文件中。



在开发过程中,当从STS(Soring Source Tools Suite;像eclips那样的一些工具)运行网站时,我只需在浏览器中刷新网站,并立即看到所做的更改,对邮件所做的所有更改.properties文件已经正确生效。

但是在部署的应用程序中(相同的代码相同的配置没有错误),管理员执行相同的操作,编辑资源与之前一样,message.properties文件正确保存了新的值,但是,除非重新启动tomcat,否则在几小时后我没有看到浏览器中的更改!



我禁用了tomcat 7缓存,但仍然面临同样的问题。
我花了4天以上的搜索时间,但所有结果都与我的问题无关,其中大部分与休眠缓存相关。所以,我的问题简单如下:



我想要在我部署的grails应用程序中使用message.properties文件,可以说message_en.properties,更改可以说default.welcome.message =欢迎使用default.welcome.message = Hello,World!
然后打开任何浏览器,并查看Hello,World!而不是欢迎



在此先感谢您的任何帮助=')

解决方案

正如他们所说,一些大问题有一个非常简单的答案!
根据我发现的帖子,在我的资源编辑器工具中,我在bootstarp中添加了以下代码(请参阅答案末尾的链接):

  def messageSource 
def saveMessageResources = {



//我的行动逻辑



messageSource.clearCache()
}

p>

参考资料: http://jira.grails。 org / browse / GPAPPENGINE-44

I have a really annoying problem with a deployed Grails application on tomcat 7

I created a tool in my website that basically allows the site admin to edit message.properties files so that he can change the messages for a certain language as he desire.

All the changes are saved successfully to the file he edited.

In development, while running the website from STS (Soring Source Tools Suite; somethng like eclips) I just refresh the website in the browser and I see the changes instantly, all the changes that made to the message.properties file for the selected language is taking effect correctly.

But in the deployed application (same code same config no errors) the admin do the same thing, edit the resources in the same way as before, the message.properties file is saved with the new values correctly, but, I dont see the changes in the browser, unless I restarted tomcat, or after number of hours!

I've disabled the tomcat 7 caching, and I still face the same problem. I've spent more than 4 days googling, but all the results are not related to my problem, and most of them are related to hibernate caching.

So, my question simply is as follows:

I want to go to a message.properties file in my deployed grails application, lets say message_en.properties, change lets say default.welcome.message=Welcome to default.welcome.message=Hello, World! And then open any browser, and see Hello, World! instead of Welcome

Thanks in advance for any help =')

解决方案

As they say, some big questions have a very simple answer! Depending on a post I found, in my resources editor tool, I added this code in my action with other few changes in the bootstarp (see link at the end of the answer):

def messageSource
def saveMessageResources={
    .
    .
    .
    //my action logic
    .
    .
    .    
    messageSource.clearCache()
}

and it worked :)

References: http://jira.grails.org/browse/GPAPPENGINE-44

这篇关于Grails message.properties更改在部署的应用程序中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆