错误详情:
ERRORorg.springframework.beans.factory.BeanCreationException: Error
creating bean with name ‘springSecurityFilterChain’ defined in class
path resource
[org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.servlet.Filter]: Factory method
‘springSecurityFilterChain’ threw exception; nested exception is
java.lang.IllegalArgumentException: Cannot pass a null
GrantedAuthority collection
原因:
必须为用户添加角色或权限
解决方式
添加相应角色或权限即可
withUser("zhangsan").password("12345").roles("aaa");