The constructor ClassPathXmlApplicationContext(String) refers to the missing type

来源:互联网 发布:51单片机引脚 编辑:程序博客网 时间:2024/04/29 18:30

The constructor ClassPathXmlApplicationContext(String) refers to the missing type


首次学习Spring Framework,通过Maven加入如下依赖:

    <dependency>            <groupId>junit</groupId>            <artifactId>junit</artifactId>            <version>3.8.1</version>            <scope>test</scope>        </dependency>        <dependency>            <groupId>commons-logging</groupId>            <artifactId>commons-logging</artifactId>            <version>1.2</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context</artifactId>            <version>4.1.6.RELEASE</version>        </dependency>

然后写一个简单的Hello World,准备从配置文件中得到Bean,出现如下错误:

“The constructor ClassPathXmlApplicationContext(String) refers to the missing type BeansException”

这里写图片描述

原因是虽然加入spring-core,spring-beans等依赖包,但是却没有正确的下载,可以点击发现下面没有对应的package,所以手动进入repository删除对应目录,让它重新更新!
这里写图片描述

这样就OK了!
这里写图片描述

1 0