在您的示例中,您不需要控制器(LoginController.java)来处理安全性,Spring Security会为您完成。删除此代码。
在AngularJs中,您需要发送POST请求才能登录。像这样 :
var data = "username="+username+"&password="+password+"&submit=Login"; $http({ method: 'POST', url: $window.domaineName + 'j_spring_security_check', data: data, headers: { 'Content-Type': 'application/x-www-form-urlenpred', } }) .success(function(data, status){ //login success }) .error(function(data, status){ // login failure })为了注销,您需要发送另一个Http POST请求:
$http({ method: 'POST', url: $window.domaineName + 'j_spring_security_logout', }) .success(function(data, status){ // logout success }) .error(function(data, status){ // logout failure })


