SpringMVC中访问一个Controller的一个方法时,调用了SecurityContextHolder.getContext().getAuthentication() ,结果显示null异常,说明在security.xml中配置时过滤掉了此地址
<intercept-url pattern="/aaa/bbb*" filters="none"/>
此时, 如果aaa Controller中的bbb开头的方法是用SecurityContextHolder.getContext().getAuthentication() 就会报空指针异常,必须删除此行配置,让Spring Security过滤此url才能使用SecurityContextHolder.getContext().getAuthentication()