1. 程式人生 > 其它 >spring迴圈依賴解決,Springboot迴圈依賴解決

spring迴圈依賴解決,Springboot迴圈依賴解決

 

================================

©Copyright 蕃薯耀 2022-04-06

https://www.cnblogs.com/fanshuyao/

 

 

一、問題描述

 

Parameter 0 of method authorizationAttributeSourceAdvisor in org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration required a bean named 'authorizer' that could not be found.

***************************
APPLICATION FAILED TO START
***************************
 
Description:
 
Parameter 0 of method authorizationAttributeSourceAdvisor in org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration required a bean named 'authorizer' that could not be found.
 
 
Action:
 
Consider defining a bean named 
'authorizer' in your configuration.

 

 

二、解決方案

增加DefaultWebSecurityManager配置

 
import javax.annotation.Resource;
 
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
@Configuration
public class ShiroConfig { @Resource private ShiroRealm shiroRealm; @Bean public DefaultWebSecurityManager defaultWebSecurityManager() { DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager(); //shiro md5加密 /* HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(); matcher.setHashAlgorithmName("md5"); matcher.setHashIterations(2); shiroRealm.setCredentialsMatcher(matcher); */ defaultWebSecurityManager.setRealm(shiroRealm); return defaultWebSecurityManager; } }

 

 

(時間寶貴,分享不易,捐贈回饋,^_^)

 

================================

©Copyright 蕃薯耀 2022-04-06

https://www.cnblogs.com/fanshuyao/