Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.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 弹簧&x27;s ReloadableResourceBundleMessageSource找不到属性文件_Spring_Spring Mvc_Spring Roo_Resourcebundle_Properties File - Fatal编程技术网

Spring 弹簧&x27;s ReloadableResourceBundleMessageSource找不到属性文件

Spring 弹簧&x27;s ReloadableResourceBundleMessageSource找不到属性文件,spring,spring-mvc,spring-roo,resourcebundle,properties-file,Spring,Spring Mvc,Spring Roo,Resourcebundle,Properties File,我在WEB-INF/i18n目录下有两个文件: 应用程序属性 messages.properties 我已经正确地配置了我的ReloadableResourceBundleMessageSourcebean,如下所示(SpringMVC): 有人能给我建议吗?我可以将属性文件移动到类路径并相应地修改配置,但我更希望了解发生了什么。在日志消息中,它说:application\u fr 请注意(fr)。 这意味着它试图寻找application.properties(application_fr

我在WEB-INF/i18n目录下有两个文件:

  • 应用程序属性
  • messages.properties
我已经正确地配置了我的ReloadableResourceBundleMessageSourcebean,如下所示(SpringMVC):


有人能给我建议吗?我可以将属性文件移动到类路径并相应地修改配置,但我更希望了解发生了什么。

在日志消息中,它说:application\u fr

请注意(fr)。 这意味着它试图寻找application.properties(application_fr.properties)的法语版本。 如果它找不到法语属性,它应该返回默认值(application.properties),这样你的道具仍然可以找到。 它寻找法语道具的原因是为了在你的应用程序中的某个地方设置语言环境。可能来自浏览器、JVM、应用程序

您可以尝试添加以下内容,以强制区域设置为英语:

<bean class="org.springframework.web.servlet.i18n.FixedLocaleResolver" p:defaultLocale="en"/>   


谢谢。正如您所说,它应该返回到
application.properties
,因此无论我将文件名更改为
application\u fr.properties
,还是添加您建议的代码,我仍然会得到错误。。。还有其他想法吗?这不是一个错误,这是一条调试信息。它的行为可能是正确的。您是否发现不正确的属性值?此外,您应该确保application.properties无论如何都存在。因此,您可以将application.properties复制到application\u fr.properties.Ummm。我不明白您的意思:另外,您应该确保application.properties无论如何都存在。因此,您可以将application.properties复制到application\u fr.properties,使其具有application\u fr.properties和application.properties?我已经试过了。。。
2012-09-03 02:59:45,911 [http-bio-8080-exec-4] DEBUG org.springframework.context.support.ReloadableResourceBundleMessageSource - Loading properties [application.properties]
2012-09-03 02:59:45,912 [http-bio-8080-exec-4] DEBUG org.springframework.context.support.ReloadableResourceBundleMessageSource - No properties file found for [WEB-INF/i18n/application_fr] - neither plain properties nor XML
2012-09-03 02:59:45,912 [http-bio-8080-exec-4] DEBUG org.springframework.context.support.ReloadableResourceBundleMessageSource - Loading properties [messages.properties]
2012-09-03 02:59:45,912 [http-bio-8080-exec-4] DEBUG org.springframework.context.support.ReloadableResourceBundleMessageSource - No properties file found for [WEB-INF/i18n/messages_fr] - neither plain properties nor XML
<bean class="org.springframework.web.servlet.i18n.FixedLocaleResolver" p:defaultLocale="en"/>