SpringSecurity实现后台管理员登录(二)

需求:login.ftl页面中登录成功后进入index.ftl页面中

 

一、pom.xml中添加json转换相关的包

	
		com.fasterxml.jackson.core
		jackson-core
		2.4.4
	
	
		com.fasterxml.jackson.core
		jackson-databind
		2.4.4
	
	
		com.fasterxml.jackson.core
		jackson-annotations
		2.4.4
	

二、applicationContext-mvc.xml中添加json转换相关的配置

	
	
	
		
		
		
		
			
				atom=application/atom+xml
				html=text/html
				json=application/json
				*=*/*
			
		
	

三、applicationContext-security.xml中

改为

 

这里只是要实现简单的登录功能,所以没有设计权限。加了access=” "ROLE_AUTHORITY”会导致无法登录。

 

四、实现效果

SpringSecurity实现后台管理员登录(二)_第1张图片

 

SpringSecurity实现后台管理员登录(二)_第2张图片

 

你可能感兴趣的:(Java)