The type org.springframework.context.support.AbstractApplicationContext cannot be resolved. It is in

最近在学习spring框架中,在myeclipse中做hello world小例子,使用jdk6,下载了最新版本的spring-framework-5.1.3.RELEASE,代码如下:

package com.read;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainApp {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ApplicationContext context = (ApplicationContext) new ClassPathXmlApplicationContext("Beans.xml");
		HelloWorld hello = (HelloWorld) context.getBean("helloworld");
		hello.getMessage();
	}

}

结果报错了:

The type org.springframework.context.support.AbstractApplicationContext cannot be resolved. It is indirectly referenced from
required .class files

找了一圈原因,最后确定spring-framework-5.1.3.RELEASE需要jdk8,本人的myeclipse版本又比较低,支持不了高版本的jdk,所有就下载了较早版本的spring-framework-4.1.7.RELEASE,依然使用jdk6,没有再报错。

猜你喜欢

转载自blog.csdn.net/liuyunyihao/article/details/86080495
今日推荐