Internationalization of spring security and configuration and use of usercache
International configuration
The path of the message file is configured in basename
In spring-security-core-3.2 0.M1. Org. Jar package springframework. The internationalization file can be found under security, which can be directly used. This class can also be used in the project
In this way, MessageSource can be used in the class. MessageSource provides the following three methods
1.String getMessage(String code, Object[] args, String defaultMessage, Locale locale);
2.String getMessage(String code, Locale locale) throws NoSuchMessageException;
3.String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException;
For example, we define the following message in the property file
1.UserDetails. Islocked = user locked
2.UserDetails. Usernotfound = user {0} does not exist
Then use the GetMessage method
Usercache configuration is implemented through ecahe
ehcache. xml
In this way, it can be passed in the program
The user object is of type userdetails
summary
The above is about the internationalization of spring security and the configuration and use of usercache introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!