apache shiro在加载shiroFilter时报BeanCurrentlyInCreationException异常

今天启动工程时在控制台发现一段不影响项目加载的日志,如下

10:14:35 [DefaultSingletonBeanRegistry.getSingleton] [DEBUG] Creating shared instance of singleton bean 'shiroFilter'
10:14:35 [AbstractBeanFactory.getTypeForFactoryBean] [DEBUG] Ignoring bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'shiroFilter' : Requested bean is currently in creation: Is there an unresolvable circular reference?

在网上搜索了一下,发现将自定义UserRealm做一下修改即可

1、将userService属性的Autowired注解去掉,增加getter和setter方法
public class UserRealm extends AuthorizingRealm {
    //@Autowired
    private UserService userService;
    
    public UserService getUserService() {
	return userService;
    }

    public void setUserService(UserService userService) {
	this.userService = userService;
    }
}

2、修改spring-shiro.xml配置文件,通过在xml文件配置的形式注入 userService的实例


    
        
        
        
        
        
        
        
    


你可能感兴趣的:(apache shiro在加载shiroFilter时报BeanCurrentlyInCreationException异常)