我在配置Spring MessageSource以忽略我的系统区域设置时遇到问题.当我使用null locale参数调用getMessage时,我希望我的MessageSource选择默认属性文件messages.properties.相反,它选择messages_en.properties.当我将此属性文件的名称更改为messages_fr.properties时,将选择默认属性文件.我的系统区域设置是'en'.所以似乎MessageSource忽略了我设置为false的fallbackToSystemLocale属性.
此行为与Spring版本4.1.4以及4.1.5相同.
MessageSource配置:
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="fallbackToSystemLocale" value="false"></property>
<property name="basenames">
<list>
<value>locale/messages</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8"></property>
</bean>
Run Code Online (Sandbox Code Playgroud)
收到消息:
String message = messageSource.getMessage("user.email.notFound", new Object[] {email}, null);
Run Code Online (Sandbox Code Playgroud)
谢谢你的建议!
我试图描述订阅我的应用程序实例的话题在这里。为一个应用程序实例创建关系映射正常。
当我尝试为多个应用程序实例创建关系映射时出现问题。无论我是否匹配此处描述的主题名称的正则表达式,GCM都会返回HTTP状态400,错误为“主题名称格式无效” 。
即使来自文档的示例POST请求也无法再次出现相同的错误消息,并且无法找到任何主题名称,而该主题名称却无法成功通过该请求。
请求
https://iid.googleapis.com/iid/v1:batchAdd
Content-Type:application/json
Authorization:key=API_KEY
{
"to": "movies",
"registration_tokens": ["nKctODamlM4:CKrh_PC8kIb7O...", "1uoasi24:9jsjwuw...", "798aywu:cba420..."],
}
Run Code Online (Sandbox Code Playgroud)
响应
HTTP 400 Bad Request
{
"error": "Topic name format is invalid"
}
Run Code Online (Sandbox Code Playgroud)
对于batchRemove请求,也会发生相同的情况。