spring配置文件-------通配符

<!-- 這里一定要注意是使用spring的mappingLocations屬性進行通配的 -->
????? <property name="mappingLocations">
???????? <list>
??????????? <value>classpath:/com/model/domain/*.hbm.xml</value>

???????? </list>
????? </property>

----------------------------------------------------------------------------------------------------------------------------------(割割更健康)

spring整合hibernate配置文件中的sessionfactory中,配置映射文件有好多種方法:

LocalSessionFactoryBean有好幾個屬性用來查找hibernate映射文件:mappingResources、mappingLocations、mappingDirectoryLocations與mappingJarLocations。

他們的區別:
mappingResources:指定classpath下具體映射文件名
<property name="mappingResources">
? <value>petclinic.hbm.xml</value>
</property>


mappingLocations:可以指定任何文件路徑,并且可以指定前綴:classpath、file等
<property name="mappingLocations">
? <value>/WEB-INF/petclinic.hbm.xml</value>
</property>

<property name="mappingLocations">
? <value>classpath:com/company/domain/petclinic.hbm.xml</value>
</property>
也可以用通配符指定,'*'指定一個文件(路徑)名,'**'指定多個文件(路徑)名,例如:
<property name="mappingLocations">
? <value>classpath:com/company/domain/**/maps/*.hbm.xml</value>
</property>
上面的配置是在com/company/domain包下任何maps路徑下的hbm.xml文件都被加載為映射文件mappingDirectoryLocations:指定映射的文件路徑
mappingJarLocations:指定加載的映射文件在jar文件中

?注意:當有mappingLocations存在時,mappingResources中對hibernate映射文件的配置是不加載的,因此,需要把映射文件配置都放到mappingLocations中

轉載于:https://www.cnblogs.com/wuyulunbi/archive/2012/12/28/spring_1.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/274403.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/274403.shtml
英文地址,請注明出處:http://en.pswp.cn/news/274403.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

若川知乎問答:2年前端經驗,做的項目沒什么技術含量,怎么辦?

知乎問答&#xff1a;做了兩年前端開發&#xff0c;平時就是拿 Vue 寫寫頁面和組件&#xff0c;簡歷的項目經歷應該怎么寫得好看&#xff1f;以下是我的回答&#xff0c;閱讀量5000&#xff0c;所以發布到公眾號申明原創。題主說的2年經驗做的東西沒什么技術含量&#xff0c;應…

ui設計基礎_我不知道的UI設計的9個重要基礎

ui設計基礎重點 (Top highlight)After listening to Craig Federighi’s talk on how to be a better software engineer I was sold on the idea that it is super important for a software engineer to learn the basic principles of software design.聽了克雷格費德里希(C…

Ubuntu下修改file descriptor

要修改Ubuntu下的file descriptor的話&#xff0c;請參照一下步驟。&#xff08;1&#xff09;修改limits.conf  $sudo vi /etc/security/limits.conf  增加一行  *  -  nofile  10000&#xff08;2&#xff09;修改 common-session  $ sudo vi/etc/pam.d/common…

C# 多線程控制 通訊 和切換

一.多線程的概念   Windows是一個多任務的系統&#xff0c;如果你使用的是windows 2000及其以上版本&#xff0c;你可以通過任務管理器查看當前系統運行的程序和進程。什么是進程呢&#xff1f;當一個程序開始運行時&#xff0c;它就是一個進程&#xff0c;進程所指包括運行中…

vue路由匹配實現包容性_包容性設計:面向老年用戶的數字平等

vue路由匹配實現包容性In Covid world, a lot of older users are getting online for the first time or using technology more than they previously had. For some, help may be needed.在Covid世界中&#xff0c;許多年長用戶首次上網或使用的技術比以前更多。 對于某些人…

IPhone開發 用子類搞定不同的設備(iphone和ipad)

用子類搞定不同的設備 因為要判斷我們的程序正運行在哪個設備上&#xff0c;所以&#xff0c;我們的代碼有些混亂了&#xff0c;IF來ELSE去的&#xff0c;記住&#xff0c;將來你花在維護代碼上的時間要比花在寫代碼上的時間多&#xff0c;如果你的項目比較大&#xff0c;且IF語…

見證開戶_見證中的發現

見證開戶Each time we pick up a new video game, we’re faced with the same dilemma: “How do I play this game?” Most games now feature tutorials, which can range from the innocuous — gently introducing each mechanic at a time through natural gameplay — …

使用JXL組件操作Excel和導出文件

使用JXL組件操作Excel和導出文件 原文鏈接&#xff1a;http://tianweili.github.io/blog/2015/01/29/use-jxl-produce-excel/ 前言&#xff1a;這段時間參與的項目要求做幾張Excel報表&#xff0c;由于項目框架使用了jxl組件&#xff0c;所以把jxl組件的詳細用法歸納總結一下。…

facebook有哪些信息_關于Facebook表情表情符號的所有信息

facebook有哪些信息Ever since worldwide lockdown and restriction on travel have been imposed, platforms like #Facebook, #Instagram, #Zoom, #GoogleDuo, & #Whatsapp have become more important than ever to connect with your loved ones (apart from the sourc…

M2總結報告

團隊成員 李嘉良 http://home.cnblogs.com/u/daisuke/ 王熹 http://home.cnblogs.com/u/vvnx/ 王冬 http://home.cnblogs.com/u/darewin/ 王泓洋 http://home.cnblogs.com/u/fiverice/ 劉明 http://home.cnblogs.com/u/liumingbuaa/ 由之望 http://www.cnbl…

react動畫庫_React 2020動畫庫

react動畫庫Animations are important in instances like page transitions, scroll events, entering and exiting components, and events that the user should be alerted to.動畫在諸如頁面過渡&#xff0c;滾動事件&#xff0c;進入和退出組件以及應提醒用戶的事件之類的…

Weather

public class WeatherModel { #region 定義成員變量 private string _temperature ""; private string _weather ""; private string _wind ""; private string _city ""; private …

線框模型_進行計劃之前:線框和模型

線框模型Before we start developing something, we need a plan about what we’re doing and what is the expected result from the project. Same as developing a website, we need to create a mockup before we start developing (coding) because it will cost so much…

撰寫論文時word使用技巧(轉)

------------------------------------- 1. Word2007 的表格自定義格式額度功能是很實用的&#xff0c;比如論文中需要經常插入表格的話&#xff0c; 可以在“表格設計”那里“修改表格樣式”一次性把默認的表格樣式設置為三線表&#xff0c;這樣&#xff0c; 你以后每次插入的…

工作經驗教訓_在設計工作五年后獲得的經驗教訓

工作經驗教訓This June it has been five years since I graduated from college. Since then I’ve been working as a UX designer for a lot of different companies, including a start-up, an application developer, and two consultancy firms.我從大學畢業已經五年了&a…

Wayland 源碼解析之代碼結構

來源&#xff1a;http://blog.csdn.net/basilc/article/details/8074895 獲取、編譯 Wayland 及其依賴庫可參考 Wayland 官方網站的 Build 指南&#xff1a;http://wayland.freedesktop.org/building.html。 Wayland 實現的代碼組成可以分成以下四部分&#xff1a; 1. Wayland…

中文排版規則_非設計師的5條排版規則

中文排版規則01僅以一種字體開始 (01 Start with only one font) The first tip for non-designers dealing with typography is simple and will make your life much easier: Stop combining different fonts you like individually and try using only one font in your fut…

基本響應性的Web設計測試工具

在重新設計頁面的過程中。要使頁面完全響應的設計&#xff08;這意味著它會重新調整大小根據瀏覽器的尺寸和方向&#xff09;。如iPhone和iPad的移動電話和平板電腦我碰到了一些非常方便的響應設計工具&#xff0c;幫我測試網站在不同的屏幕響應。下面的這些響應的網頁設計工具…

ux設計_聲音建議:設計UX聲音的快速指南

ux設計Mating calls, warning grunts, and supportive coos are some of the sounds heard throughout the animal kingdom. All species use finely-tuned noises to communicate to one another and inform others of an action or behavior. We humans aren’t all that dif…

css3高級和低級樣式屬性先后順序

寫css hack 時&#xff0c;由于hack主要針對的是個別瀏覽器&#xff0c;hack的書寫順序應當是從一般到特殊的寫法。 如&#xff1a; .box { width:200px; height:200px; position:fixed; left:0; top:0; _position:absolute; } 如果顛倒順序&#xff0c;從特殊到一般&#xff0…