Spring security 2.0.5. custom login form. Cannot see errors in language other than English
-
06-07-2019 - |
Question
I've got my Spring Security custom login form working. It displays errors if the user has input bad credentials, or is expired, etc.
Looking inside spring-security-core-2.0.5.RELEASE.jar, I notice the following files in the org.springframework.security package:
messages.properties messages_cs_CZ.properties messages_de.properties messages_fr.properties ...etc...
and notice that they have the localised versions of the strings.
Setting my browser's preferred language to French doesn't make the French version of the string appear. What am I missing?
PUK
Solution
Fixed it:
In my applicationContext.xml I include the Spring Security messages by adding another basename:
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>com.myapp.web.my_messages</value>
<value>org.springframework.security.messages</value>
</list>
</property>
</bean>
In my web.xml I added another listener:
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow