Spring Security登录页面回显提示与中文提示处理

<div th:if="${param.error}">
      <span th:text="${session.SPRING_SECURITY_LAST_EXCEPTION?.message}" style="color: red">用户名或者密码错误</span>
</div>
package com.mengxuegu.security.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

@Configuration
public class ReloadMessageConfig {
    @Bean //加载中文认证提示信息
    public ReloadableResourceBundleMessageSource messageSource(){
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
        messageSource.setBasename("classpath:org/springframework/security/messages_zh_CN");
        return messageSource;
    }
}
posted @ 2020-11-03 21:23  xl4ng  阅读(668)  评论(0编辑  收藏  举报