spring boot 整合shiro 配置类报错问题这里传入的是下边返回的自定义Realm,下边是报错,报的是该类不能被装载,由jdk自己装载,这里不是太懂,记录一下,由于错误太长,不好截屏,直接复制错误内容

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG //
////////////////////////////////////////////////////////////////////
2018-01-09 00:42:22.862  INFO 8980 --- [           main] org.fsc.EnterBoot                        : Starting EnterBoot on PC-20160923LSVW with PID 8980 (D:\Users\Administrator\eclipse-workspace\SpringBoot\target\classes started by Administrator in D:\Users\Administrator\eclipse-workspace\SpringBoot)
2018-01-09 00:42:22.881  INFO 8980 --- [           main] org.fsc.EnterBoot                        : No active profile set, falling back to default profiles: default
2018-01-09 00:42:23.202  INFO 8980 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]79ad8b2f: startup date [Tue Jan 09 00:42:23 CST 2018]; root of context hierarchy
+++++++++++++++shiro配置被加载+++++++++++++++++++++
2018-01-09 00:42:28.476  INFO 8980 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'shiroConfiguration' of type [class org.fsc.MyShiro.ShiroConfig.ShiroConfiguration$$EnhancerBySpringCGLIB$$49dc09f0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-09 00:42:28.553  INFO 8980 --- [           main] o.f.M.ShiroConfig.ShiroConfiguration     : --------------(shiro生命周期)lifecycleBeanPostProcessor已经加载----------------
2018-01-09 00:42:28.933  INFO 8980 --- [           main] o.f.M.ShiroConfig.ShiroConfiguration     : --------------cacheManager已经加载----------------
2018-01-09 00:42:31.553  INFO 8980 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'cacheManager' of type [class org.apache.shiro.cache.ehcache.EhCacheManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-09 00:42:32.003  INFO 8980 --- [           main] o.f.M.ShiroConfig.ShiroConfiguration     : --------------(shiro密码比较器)credentialsMatcher已经加载----------------
2018-01-09 00:42:32.029  INFO 8980 --- [           main] o.a.shiro.cache.ehcache.EhCacheManager   : Using existing EHCache named [passwordRetryCache]
2018-01-09 00:42:32.062  INFO 8980 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'credentialsMatcher' of type [class org.fsc.MyShiro.CredentialsMatcher.RetryLimitHashedCredentialsMatcher] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-09 00:42:32.115  INFO 8980 --- [           main] o.f.M.ShiroConfig.ShiroConfiguration     : --------------authRealm已经加载----------------
MyAutoRealm+++++++++++++++++++++++++++++++++++++++++++++++++++
2018-01-09 00:42:32.125  INFO 8980 --- [           main] o.a.shiro.cache.ehcache.EhCacheManager   : Cache with name 'org.fsc.MyShiro.MyRealm.MyAutoRealm.authorizationCache' does not yet exist.  Creating now.
2018-01-09 00:42:32.200  INFO 8980 --- [           main] o.a.shiro.cache.ehcache.EhCacheManager   : Added EhCache named [org.fsc.MyShiro.MyRealm.MyAutoRealm.authorizationCache]
2018-01-09 00:42:32.259  INFO 8980 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'myAutoRealm' of type [class org.fsc.MyShiro.MyRealm.MyAutoRealm] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-09 00:42:32.404  WARN 8980 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroFilter' defined in class path resource [org/fsc/MyShiro/ShiroConfig/ShiroConfiguration.class]: Unsatisfied dependency expressed through method 'shiroFilter' parameter 0: Error creating bean with name 'securityManager' defined in class path resource [org/fsc/MyShiro/ShiroConfig/ShiroConfiguration.class]: Unsatisfied dependency expressed through method 'securityManager' parameter 0: Bean named 'myAutoRealm' is expected to be of type [org.fsc.MyShiro.MyRealm.MyAutoRealm] but was actually of type [com.sun.proxy.$Proxy51]; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'myAutoRealm' is expected to be of type [org.fsc.MyShiro.MyRealm.MyAutoRealm] but was actually of type [com.sun.proxy.$Proxy51]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityManager' defined in class path resource [org/fsc/MyShiro/ShiroConfig/ShiroConfiguration.class]: Unsatisfied dependency expressed through method 'securityManager' parameter 0: Bean named 'myAutoRealm' is expected to be of type [org.fsc.MyShiro.MyRealm.MyAutoRealm] but was actually of type [com.sun.proxy.$Proxy51]; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'myAutoRealm' is expected to be of type [org.fsc.MyShiro.MyRealm.MyAutoRealm] but was actually of type [com.sun.proxy.$Proxy51]
Related cause: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'shiroFilter': Requested bean is currently in creation: Is there an unresolvable circular reference?
2018-01-09 00:42:32.477 ERROR 8980 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 


***************************
APPLICATION FAILED TO START
***************************


Description:


The bean 'myAutoRealm' could not be injected as a 'org.fsc.MyShiro.MyRealm.MyAutoRealm' because it is a JDK dynamic proxy that implements:




Action:


Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.

解决办法:

将传入的自定义myAutoRealm改为他的父类Realm就好了,理由还不解,有大佬懂么





相关文章:

  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
猜你喜欢
  • 2021-06-09
  • 2022-01-03
  • 2021-04-09
  • 2018-05-22
  • 2021-09-25
相关资源
相似解决方案