SpringBoot整合Shiro ShiroRealm类中 @Autowired注入 Service为 null 问题

    今天在整合 SpringBoot 与 Shiro时候,一直提示@Autowired 注入的Service为空 ,很纳闷;

这是摘抄出来的错误

java.lang.NullPointerException

at com.lu.vote1.config.ShiroRealm.doGetAuthenticationInfo(ShiroRealm.java:67)

org.apache.shiro.authc.UnknownAccountException: Realm [com.lu.vote1.config.ShiroRealm@17ad6988] was unable to find account data for the submitted AuthenticationToken [org.apache.shiro.authc.UsernamePasswordToken - admin, rememberMe=false].



最后在百度了半个小时的时候终于解决了,原来是在ShiroConfig配置类中 忘记给  创建ShiroRealm的方法上加Bean注解,是不可以直接new的;




总之错误解决了,但是还有下一个错误等着我。我先去改错了,拜拜喽;



版权声明:本文为qq_38593865原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。