shiro 整合到springboot 还是比较简单的,只需要新建一个spring-shiro.xml的配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"
default-lazy-init="true">
<description>Shiro Configuration</description>
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="realm" ref="ShiroRealm" />
</bean>
<!-- 項目自定义的Realm -->
<bean id="ShiroRealm" class="org.spring.springboot.interceptor.shiro.ShiroRealm" ></bean>
<!-- Shiro Filter -->
<bean id="shiroFilter" clas

本文介绍了如何在Springboot中整合Shiro并进行Url拦截设置。重点在于理解filterChainDefinitions,包括静态资源的访问配置(如去掉/static前缀)以及/**规则的放置顺序。作者认为Springboot的WebMvcConfigurerAdapter虽然便捷,但XML配置更灵活。通过引入spring-shiro.xml配置文件并将其置于classpath下,即可实现配置生效。
最低0.47元/天 解锁文章
890

被折叠的 条评论
为什么被折叠?



