qq_23092651 2017-05-13 06:05 采纳率: 0%
浏览 1101

spring+hibernate+shiro出错,找了一天了,呜呜

rg.springframework.context.support.AbstractApplicationContext.refresh(549) | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in file [H:\IdeaProjects\javaWeb\Article\target\Article\WEB-INF\classes\spring-shiro.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor#0' defined in file [H:\IdeaProjects\javaWeb\Article\target\Article\WEB-INF\classes\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' defined in file [H:\IdeaProjects\javaWeb\Article\target\Article\WEB-INF\classes\spring-shiro.xml]: Cannot resolve reference to bean 'myRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException:

Error creating bean with name 'myRealm': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Can not set com.liwei.service.impl.UserServiceImpl field com.liwei.service.impl.MyRealm.userServiceImpl to com.sun.proxy.$Proxy209

  • 写回答

1条回答 默认 最新

  • qq_23092651 2017-05-13 06:34
    关注

    @Autowired
    private UserService userService;
    注入的必须是接口

        spring项目启动报错:
    

    初次使用spring MVC注解模式进行事务控制
    由于spring AOP动态代理默认是通过接口,所以注入事务层的地方都要通过接口进行注入,如果通过实现类进行注入就会报这个错
    有人说可以进行配置,然后也可以支持实体类的事务层注入,在配置

    中加入
    proxy-target-class="true"
    即可

    评论

报告相同问题?

悬赏问题

  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp