将Spring Security从5迁移到6.0。在异常之后,我尝试了所有可能的解决方案,但都没有成功。谁来帮帮我。
java.lang.NullPointerException: Cannot invoke "org.springframework.security.authentication.AuthenticationManager.authenticate(org.springframework.security.core.Authentication)" because the return value of "org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.getAuthenticationManager()" is null
at com.jmi.jabord.core.oauth.filter.AccessTokenAuthenticationFilter.attemptAuthentication(AccessTokenAuthenticationFilter.java:79)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:231)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
我试着在我的Filter类extends AbstractAuthenticationProcessingFilter
中添加这个:
@Autowired
@Qualifier("authenticationManager")
@Override
public void setAuthenticationManager(AuthenticationManager authenticationManager) {
super.setAuthenticationManager(authenticationManager);
}
但对我来说都没有用。
1条答案
按热度按时间nr9pn0ug1#
在安全配置类中,您可以尝试添加以下内容: