================================
©Copyright Sweet Potato Yao 2022-04-06
Sweet Potato Yao's Blog - CSDN Blog
1. Problem description
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.
2. Solutions
Add DefaultWebSecurityManager configuration
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;
}
}
(Time is precious, sharing is not easy, donate and give back, ^_^)
================================
©Copyright Sweet Potato Yao 2022-04-06