【问题标题】:Embedded tomcat won't resolve Spring application resource bundle for message source嵌入式 tomcat 不会解析消息源的 Spring 应用程序资源包
【发布时间】:2012-09-22 02:03:44
【问题描述】:

我的嵌入式 tomcat 遇到问题:当我使用嵌入式 Tomcat 运行 Spring 应用程序时,属性似乎没有解析。

即使加载了属性文件:

INFO  org.springframework.context.support.PropertySourcesPlaceholderConfigurer - Loading properties file from file [/home/julien/Documents/donnees/projets/Site-Rencontres/java/target/classes/META-INF/i18n/application.properties]

找不到资源包:

WARN  org.springframework.context.support.ResourceBundleMessageSource - ResourceBundle [/META-INF/i18n/application] not found for MessageSource: Can't find bundle for base name /META-INF/i18n/application, locale fr

但是,当我从 Eclipse/STS 运行我的应用程序时,我没有这样的问题。

【问题讨论】:

    标签: spring maven properties-file maven-tomcat-plugin


    【解决方案1】:

    我对问题进行了部分排序。通过在此处删除前导斜杠(在 Spring 配置中):

    <property name="basenames" value="/META-INF/i18n/application,/META-INF/i18n/messages" />
    

    获得这个:

    <property name="basenames" value="META-INF/i18n/application,META-INF/i18n/messages" />
    

    问题已解决。

    但是,嵌入式 Tomcat 和标准 Tomcat 之间的行为差​​异首先是什么原因造成的,我不解释...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-16
      • 1970-01-01
      • 2017-03-26
      相关资源
      最近更新 更多