码迷,mamicode.com
首页 > 其他好文 > 详细

Shiro 注解不生效的解决办法

时间:2020-04-24 14:23:18      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:ati   manage   ref   creat   ram   tcl   tar   uri   apache   

SSM

在shiro.xml中注册两个Bean

<bean id="authorizationAttributeSourceAdvisor"
          class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
        <property name="securityManager" ref="securityManager"></property>
</bean>
<bean id="defaultAdvisorAutoProxyCreator"
          class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
        <property name="proxyTargetClass" value="true"></property>
</bean>

SpringBoot

在配置类中注册两个Bean

@Bean
public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator() {
    DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
    advisorAutoProxyCreator.setProxyTargetClass(true);
    return advisorAutoProxyCreator;
}
 
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor() {
    AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
    authorizationAttributeSourceAdvisor.setSecurityManager(securityManager());
    return authorizationAttributeSourceAdvisor;
}

Shiro 注解不生效的解决办法

标签:ati   manage   ref   creat   ram   tcl   tar   uri   apache   

原文地址:https://www.cnblogs.com/dingjn/p/12767169.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!