H5W3
当前位置:H5W3 > java > 正文

【Java】shiro配置报错

问题描述

全新的测试环境,只加入了spring-boot-starter-web(2.0.3),shiro-spring(1.4.0).
仅添加了一个shiroconfig配置类,内容如下

import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author cmit2 on 2019-06-25
* @version 1.0
*/
@Configuration
public class ShiroConfig {
/**
* 配置WebSecurityManager
* @return
*/
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
return securityManager;
}
@Bean
public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager)
{
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
// Shiro的核心安全接口,这个属性是必须的
shiroFilterFactoryBean.setSecurityManager(securityManager);
return shiroFilterFactoryBean;
}
}

运行时有提示:

Bean 'shiroConfig' of type [cn.enfix.test.config.ShiroConfig$$EnhancerBySpringCGLIB$$f8c8c59] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Bean 'securityManager' of type [org.apache.shiro.web.mgt.DefaultWebSecurityManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

如果将ShiroFilterFactoryBean方法注释掉,以上提示就不会出现了.
请问有何解决方法,非常感谢~~~

回答

我的也是这样的报错,我是再Spring Boot Application上加了@MapperScan注解问题就解决了

本文地址:H5W3 » 【Java】shiro配置报错

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址