Java Spring security没有';错误是org.springframework.beans.factory.BeanCreationException
这是我的安全xml文件 spring security.xmlJava Spring security没有';错误是org.springframework.beans.factory.BeanCreationException,java,spring,spring-mvc,spring-security,Java,Spring,Spring Mvc,Spring Security,这是我的安全xml文件 spring security.xml <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd">
<http auto-config="true">
<intercept-url pattern="/user**" access="ROLE_USER" />
<intercept-url pattern="/admin**" access="ROLE_ADMIN" />
<form-login
always-use-default-target="true"
login-page="/login"
default-target-url="/welcome"
login-processing-url="/checkUser"
authentication-failure-url="/login?error"
username-parameter="username"
authentication-success-handler-ref="authenticationSuccessHandler"
password-parameter="password" />
<logout logout-url="/login?logout" />
<csrf/>
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user" password="123456" authorities="ROLE_USER" />
<user name="admin" password="123456" authorities="ROLE_ADMIN" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
您应该在spring-security.xml中定义id为authenticationSuccessHandler的bean和CustomAuthenticationSuccessHandler类发布堆栈跟踪…我在servlet-dispatcher.xml文件中创建了bean。抱歉..您是对的。问题已解决。感谢您的帮助。
package com.mehman.puyment.security;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
public class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
System.out.println("!***********************************************!");
}
}