Ich arbeite an einem Maven-Projekt mit Spring Framework.Spring findet keine messages.properties
Anstatt rohen Text in JSPs zu schreiben, verwende ich lieber <spring:message .../>
, um meine Nachrichten in einer .properties-Datei zu markieren und zu registrieren.
bekomme ich diese Warnung, wenn eine Seite anfordert:
Resource [messages] nicht für Message gefunden: Kann nicht finden Bündel für Basisnamen Nachrichten, locale fr
die dann bringt eine Ausnahme bezüglich der Nachricht, die (offensichtlich) nicht gefunden wurde.
Hier Hierarchie mein Projekt:
Hier ist mein springapp-servlet.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:component-scan base-package="app.core" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/">
</property>
<property name="suffix" value=".jsp">
</property>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="fr" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
</bean>
<mvc:resources mapping="/public/**" location="/WEB-INF/resources/"
cache-period="31556926"/>
<mvc:annotation-driven />
</beans>
Es hat funktioniert! Vielen Dank ! Auch wenn meine IDE (intellij idea) vor dem basename Wert warnt. –