Error creating bean with name 'shiroFilter' defined in class path resource [spring-shiro.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager'……
类似于这种错误,这是springmvc配置文件 优先级不够的原因造成,需要在web.xml文件中作调整:
<context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:config/spring.xml, classpath:config/spring-shiro.xml </param-value> </context-param>
因为shiro处于filter级别,过滤的时候spring中的bean还没有被使用出来。写了这配置以后,如果还出错,则建议检查applicationContext.xml中的扫描包看是否被扫进来,还有就是自定义中的realm在spring-shiro.xml中是否配置正确。