请教大家一个问题:spring从jar中加载 Resource的问题“!

我找了一下,貌似这个问题也有很多人遇到过,

在spring中使用 :

classpath*: contextA.xml
classpaht*: com/pg1/**/*Context.xml

以上两个pattern来加载 context的时候,在不打包的情况下是没有任何问题的,但是打包以后 ,貌似pattern中带*的都不能加载了。
即:
classpath*: contextA.xml 可以加载而
classpaht*: com/pg1/**/*Context.xml加载不到任何文件。

有人说是 jdk的原因,本人用的是1.5.0.

哪位高人遇到过的话请指教,感激不尽!


找到原因了,直接使用myeclipse导出的jar无法被识别!!!
使用fatjar打包的能够识别出来!!
21:58:33,406 INFO ClassPathXmlApplicationContext:412 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1f20eeb: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1f20eeb]; startup date [Wed Nov 12 21:58:33 CST 2008]; root of context hierarchy
21:58:33,718 INFO XmlBeanDefinitionReader:323 - Loading XML bean definitions from file [E:\Program\EclipseWorkSpace\p2\bin\conf\conContext.xml]
21:58:34,062 INFO XmlBeanDefinitionReader:323 - Loading XML bean definitions from URL [jar:file:/C:/Documents%20and%20Settings/Administrator/%e6%a1%8c%e9%9d%a2/p1_fat.jar!/com/qking/service/serviceContext.xml]
21:58:34,218 INFO XmlBeanDefinitionReader:323 - Loading XML bean definitions from URL [jar:file:/C:/Documents%20and%20Settings/Administrator/%e6%a1%8c%e9%9d%a2/p1_fat.jar!/com/qking/vo/voContext.xml]
21:58:34,296 INFO ClassPathXmlApplicationContext:427 - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@1f20eeb]: org.springframework.beans.factory.support.DefaultListableBeanFactory@c8f6f8
21:58:34,328 INFO DefaultListableBeanFactory:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c8f6f8: defining beans []; root of factory hierarchy

哎!!搞了半天!

MyEclipse从来就没有感觉好用过,一直是eclipse + subclipse + springide + propeditor,打包用ant。越简单越强大。

丢弃myeclipse/eclipse,投入idea的怀抱吧。

不过用ide带的工具打包也确实太落后了点,看看ant脚本吧。

一直对myeclipse没有什么好感。
我使用eclipse + wtp。
build tools使用maven。maven实在太强大了~~ 越来越喜欢