Consider defining a bean named 'authenticator' in your configuration.

SpringBoot整合Shiro时出错

错误:

2018-10-31 15:49:38.697 ERROR --- [restartedMain] o.s.b.d.LoggingFailureAnalysisReporter: 

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

Description:

Parameter 0 of method authorizationAttributeSourceAdvisor in com.csair.etm.manage.configuration.ShiroConfiguration required a bean named 'authenticator' that could not be found.


Action:

Consider defining a bean named 'authenticator' in your configuration.



     org.apache.shiro
     shiro-spring
     1.4.0
 
 
 
 
     org.apache.shiro
     shiro-spring-boot-web-starter
     1.4.0
 

原因:

在starter的org.apache.shiro.spring.config.web.autoconfigure类已经定义了securityManager,代码如下:

   @Bean
   @ConditionalOnMissingBean
   protected SessionsSecurityManager securityManager(List<Realm> realms) {
       return super.securityManager(realms);
   }

所以把注入的securityManager类型换成SessionSecurityManager就可以了

你可能感兴趣的:(SpringBoot)