Spring读取配置文件的问题???

我的配置文件改名了applicationContext-a.xml还有别的applicationContext-b.xml都放在src目录下但是当我这样读取时BeanFa... 我的配置文件改名了

applicationContext-a.xml 还有别的applicationContext-b.xml

都放在src目录下

但是当我这样读取时

BeanFactory factory = new ClassPathXmlApplicationContext(
"applicationContext-*.xml");

却报异常

2008-10-28 20:43:37,656 INFO [org.springframework.core.CollectionFactory] - JDK 1.4+ collections available
Exception in thread "main" java.lang.IllegalArgumentException: Resource path [G:\Spring缁冧范1\why_spring\bin] does not denote a directory
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.retrieveMatchingFiles(PathMatchingResourcePatternResolver.java:489)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindMatchingFileSystemResources(PathMatchingResourcePatternResolver.java:469)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:452)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:321)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:255)
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:768)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:141)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:168)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:94)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:294)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:68)
at com.jimmy.hibernate.get.main(get.java:10)
那要是多个文件呢 怎么写啊?
展开
 我来答
九书
2008-10-28 · TA获得超过418个赞
知道小有建树答主
回答量:374
采纳率:100%
帮助的人:95.4万
展开全部
文件就写文件名,用-*来代替不行的。
冬雁wind
2008-10-28
知道答主
回答量:9
采纳率:0%
帮助的人:0
展开全部
加载时可以用*好,你用代码时要写文件名,
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式