spring - hibernate load *.hbm.xml from classpath resource

后端 未结 5 640
野的像风
野的像风 2021-01-19 15:04

I have some hbm.xml files in classpath resource located in src/main/resources maven\'s folder. I used spring\'s LocalSessionFactoryBean to load these files with the followin

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-19 15:42

    In web applications, when you write a resource path without prefix, Spring loads it from a context root (i.e., from a folder containing WEB-INF). To load resources from a classpath you should use "classpath:" prefix:

    classpath:mapping/SystemUser.hbm.xml
    

提交回复
热议问题