1.加入spring jar 包并配置 web.xml
spring依賴ja包
web.xml:
application.xml:
spring配置文件,空的
2.配置 springmvc
web.xml配置springmvc
springmvc配置文件
測試配置是否正確望蜡,新建jsp頁面并訪問驗證
3.開始整合 shiro(添加 shiro jar包)
shiro依賴 jar
4.配置 shiro(參考shiro源碼包)
參考 :shiro-root-1.3.2\samples\spring\src\main\webapp\WEB-INF目錄下的
applicationContext.xml 和 web.xml兩個文件
web.xml下添加(在參考代碼里邊找):
1.在 spring 中配置 shiro
2. 配置 CacheManager.? 2.1 需要加入 ehcache 的 jar 包及配置文件.
2.配置?cacheManager(需要導(dǎo)入 jar和配置文件hibernate有ehcache-core.jar與ehcache.xml配置文件)
配置 ehcache
3. 配置 Realm? ?3.1 直接配置實(shí)現(xiàn)了 org.apache.shiro.realm.Realm 接口的 bean
創(chuàng)建ShiroRealm.java
4.配置 LifecycleBeanPostProcessor
5.啟用 IOC 容器中使用 shiro 的注解
啟用 IOC 容器中使用 shiro 的注解
6.配置 ShiroFilter(創(chuàng)建login.jsp等頁面測試)