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 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器