我有一个 spring-jsf 集成应用程序。当我尝试从 faces-config.xml 的资源包中获取消息时,它运行没有问题。但我想将此资源包移动到 spring applicationContext.xml 但问题是,它找不到我的资源包。这是我的面孔配置;
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
<resource-bundle>
<base-name>/resources/locale/messages</base-name>
<var>msg</var>
</resource-bundle>
<locale-config>
<default-locale>es</default-locale>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
</locale-config>
</application>
</faces-config>
和我的 applicationContext.xml
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="es" />
</bean>
<bean id="msg"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages" />
<property name="useCodeAsDefaultMessage" value="true" />
<property name="defaultEncoding" value="UTF-8"/>
<property name="cacheSeconds" value="1" />
</bean>