我使用Spring MVC和Spring Security运行项目,并且我使用外部文件进行身份验证:
<user-service id="userDetailsService" properties="users.properties"/>
但是当我更改属性文件时,我被迫重启服务器。所以,我想知道是否有解决方案,标签或参数,我可以把它放在标签&#34;用户服务&#34;指定重新加载缓存的超时时间。
感谢您的帮助
答案 0 :(得分:1)
You are using the InMemory Provider and specifying the properties file option. The InMemory provider does not provide an option to reload the properties file.
You can either move to a different provider, like the daoAuthenticationProvider to store the users in a database, or implement your own UserDetailsService such that it reloads the properties file as needed.
You can find the JavaDoc for UserDetailService here: http://docs.spring.io/autorepo/docs/spring-security/4.0.3.RELEASE/apidocs/org/springframework/security/core/userdetails/UserDetailsService.html
There is an example of creating a custom UserDetalService here: Spring Security custom UserDetailsService and custom User class