




版權(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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- wifi覆蓋工程合同范本
- 充電樁充電合同范本
- 化肥 購銷合同范本
- 公司增資合同范例
- 勞動薪酬合同范本
- 出售新地磅合同范本
- 勞務派遣簡短合同范本
- 公司代理財務記賬合同范本
- 生活用水水箱清洗施工方案
- 農(nóng)村礦山出租合同范本
- 邊坡抗滑樁計算
- 工程建筑部門周例會-課件
- 2022人臉識別安全白皮書
- 體育測量與評價04心肺功能的測量與評價
- 提高意識風險防范化解能力體會發(fā)言
- 無人機應用案例-石油領(lǐng)域油氣管線巡查
- 2023年度危險作業(yè)安全監(jiān)護手冊
- 青島版三年級下冊口算題大全(全冊完整)
- 固定翼飛機的結(jié)構(gòu)和飛行原理
- 內(nèi)蒙古鄂爾多斯杭錦經(jīng)濟開發(fā)區(qū)地質(zhì)災害危險性評估報告
- 馬克思主義哲學十講
評論
0/150
提交評論