郁闷了,一个最简单的Spring小程序都没搞定

今天 按照网上的例子 自己敲了一下代码 想学习一下Spring 但是 无论怎么弄 那个applicationContext.xml就是加载不进去 郁闷死我了
我的小例子:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="helloBean" class="com.baoxiaofei.MySpring.HelloBeanZH" />
<bean id="messageBean" class="com.baoxiaofei.MySpring.MessageBean">
<property name="hello" ref="helloBean"></property>
</bean>
</beans>

测试代码如下:
package com.baoxiaofei.MySpring;

import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

public class TestMessageBean {
@Test
public void test2(){
// String[] config = {"applicationContext.xml"};
// ApplicationContext ac = new
ClassPathXmlApplicationContext(config);
ApplicationContext ac = new
FileSystemXmlApplicationContext("E:\\mywork\\myPro\\SpringTest\\src\\applicationContext.xml");
// boolean b = ac.containsBean("messageBean");
// String config1 = "/src/applicationContext.xml";
// Resource cr = new ClassPathResource(config1);
// BeanFactory ac = new XmlBeanFactory(cr);
MessageBean message = (MessageBean)ac.getBean("messageBean");
message.show();
}

}

上面加载的方式都试过了,就是不行
每次运行的时候 只会打印:
2012-4-26 23:14:43 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@1888759: startup date [Thu Apr 26 23:14:43 CST 2012]; root of context hierarchy

之后就没有了
这是为什么呢???
盼高人求解!!!
PS:
在同事电脑上和公司电脑上,都可以正常加载这个配置文件,为什么在自己家里就是不行呢?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值