================================
©著作権サツマイモ八尾2022-04-06
1.問題の説明
org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfigurationのメソッドauthorizationAttributeSourceAdvisorのパラメーター0には、「authorizer」という名前のBeanが必要でしたが見つかりませんでした。
***************************
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.ソリューション
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;
}
}
(時間は貴重です。共有は簡単ではありません。寄付して還元してください、^ _ ^)
================================
©著作権サツマイモ八尾2022-04-06