將Shiro作為應用的權(quán)限基礎(chǔ)五:SpringMVC+ApacheShiro+JPAhibernate整合配置_第1頁
將Shiro作為應用的權(quán)限基礎(chǔ)五:SpringMVC+ApacheShiro+JPAhibernate整合配置_第2頁
將Shiro作為應用的權(quán)限基礎(chǔ)五:SpringMVC+ApacheShiro+JPAhibernate整合配置_第3頁
將Shiro作為應用的權(quán)限基礎(chǔ)五:SpringMVC+ApacheShiro+JPAhibernate整合配置_第4頁
將Shiro作為應用的權(quán)限基礎(chǔ)五:SpringMVC+ApacheShiro+JPAhibernate整合配置_第5頁
已閱讀5頁,還剩6頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、將Shiro作為應用的權(quán)限基礎(chǔ) 五:SpringMVC+Apache Shiro+JPA (hibernate)整合配置 配置 web.xml,applicationContext.xml, spring-mvc.xml,applicationContext-shiro.xml ,而且 都有詳細的說明。 web.xml是web項目最基本的配置文件,看這個配置,可以快速知道 web項目使用什 么框架,它就像一個面板,切入我們想用的插件。 applicationContext.xml是spring的基本配置,主要配置數(shù)據(jù)源、 JPA實體管理器工廠、 事務; spring-mvc.xml 是 Spr

2、ingMVC 的配置; applicationContext-shiro.xml 是 shiro 的配置,主要酉己置 securityManager、 shiroFilter; web.xml param-name param-value contextConfigLocation classpath*:applicationContext*.xml org.springframework.web.util.IntrospectorCleanupListener org.springframework.web.context.ContextLoaderListener characterEnc

3、odingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true characterEncodingFilter /* hibernateFilter org.springframework.orm.jpa.support .OpenEntityManagerInViewFilter / filter-class filter-mapping filter-name hibernateFilter /* filter-name filter-class / f

4、ilter-mapping !- 必須對應 applicationContext.xml - url-pattern /* !- webAppRootKey spring_springmvc_jpa.root log4jConfigLocation classpath:perties shiroFilter / filter-name filter-class org.springframework.web.filter.DelegatingFilterProxy / filter-class targetFilterLifecycle true / param-value

5、/ init-param filter-mapping shiroFilter / filter-name !- 把log4j 的默認配置文件(perties) 目錄下.這種方式是log4j 配置Log4j 通常是 /web-inf/classes 無須其他配置。 缺點就是無法靈活的通過配置文件來指定 perties webAppRootKey 是log4j 在容器中的唯一標識,缺省為 放在 classpath 中, 默認配置方式, 的文件位置 webapp.root 這里 filter-name 中定義的 org.springframework.web.u

6、til.Log4jConfigListener - dispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:spring-mvc.xml / param-value 1 dispatcherServlet / login.jsp !- Servlet2.5 中可直接在此處執(zhí)行 Servlet 應用,如 servlet/InitSystemParamServlet - !- 這里使用了 SpringMVC 提供的 標簽, 實現(xiàn)了首頁隱藏的目的,詳見spr

7、ing-mvc.xml - !- login.jsp - applicationContext.xml bean id =dataSource” class = com.jolbox.bonecp.BoneCPDataSource” bean id =txManager class = org.springframework.orm.jpa.JpaTransactionManager1 = close destroy-method _ property name =driverClass property name =jdbcUrl property name =username proper

8、ty name = password value value =$jdbc.driverClassName) = $jdbc.url) / / value value =$jdbc.username) =$jdbc.password) bean id = entityManagerFactory org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean class property name =dataSource ref =dataSource / / ref = hibernateJpaVendorAdapter

9、/ property name =jpaProperties prop key thread = hibernate.currentsessioncontextclass prop key = hibernate.hbm2ddl.auto update / prop key = hibernate.show_sql false prop false / prop prop key =hibernate.ejb.naming_strategy org.hibernate.cfg.ImprovedNamingStrategy / prop bean id =hibernateJpaVendorAdapter org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter property name = entityManagerFactory ref = entityManagerFactory spring-mvc.xml !-默認訪問跳轉(zhuǎn)到登錄頁面,即定義無 Controller 的pathview 直接映射- !

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論